diff --git a/.cache/index.json b/.cache/index.json new file mode 100644 index 0000000..c10645e --- /dev/null +++ b/.cache/index.json @@ -0,0 +1,11 @@ +{ + "hash": 12464441102537979377, + "index": { + "complex": [ + "tests/fluids/water/u_shape.json" + ], + "pathfinding": [ + "tests/fluids/water/u_shape.json" + ] + } +} \ No newline at end of file diff --git a/tests/fluids/flowing_lava_meets_water.json b/tests/fluids/flowing_lava_meets_water.json new file mode 100644 index 0000000..375b742 --- /dev/null +++ b/tests/fluids/flowing_lava_meets_water.json @@ -0,0 +1,70 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "flowing_lava_meets_water_cobblestone", + "description": "Flowing lava (not source) that touches water becomes cobblestone. In shouldSpreadLiquid, non-source lava adjacent to water converts to cobblestone.", + "tags": ["interaction", "lava", "water", "cobblestone"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [8, 3, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [8, 0, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [8, 2, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 4], [8, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [8, 1, 0], [8, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [4, 1, 1], [4, 2, 3] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 1, "do": "place", "pos": [1, 1, 2], "block": {"id": "minecraft:lava", "level": 0} }, + { "at": 60, "do": "place", "pos": [4, 1, 2], "block": {"id": "minecraft:air"} }, + { "at": 60, "do": "place", "pos": [4, 2, 2], "block": {"id": "minecraft:air"} }, + { "at": 61, "do": "place", "pos": [7, 1, 2], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 62, + "do": "assert", + "checks": [ + { "pos": [2, 1, 2], "is": {"id": "minecraft:lava" } }, + { "pos": [1, 1, 2], "is": {"id": "minecraft:lava", "level": "0"} } + ] + }, + { + "at": 100, + "do": "assert", + "checks": [ + { "pos": [3, 1, 2], "is": {"id": "minecraft:cobblestone"} } + ] + } + ] +} + diff --git a/tests/fluids/lava_flows_down_onto_water.json b/tests/fluids/lava_flows_down_onto_water.json new file mode 100644 index 0000000..229b3e9 --- /dev/null +++ b/tests/fluids/lava_flows_down_onto_water.json @@ -0,0 +1,54 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "lava_flows_down_onto_water_stone", + "description": "Lava flowing downward onto water creates stone at the water position. In LavaFluid.spreadTo, when direction is DOWN and target has water in a LiquidBlock, the water position becomes stone.", + "tags": ["interaction", "lava", "water", "stone"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [4, 5, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [4, 0, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [4, 4, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 4], [4, 4, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 4, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [4, 1, 0], [4, 4, 4] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 1, "do": "place", "pos": [2, 1, 2], "block": {"id": "minecraft:water", "level": 0} }, + { "at": 2, "do": "place", "pos": [2, 3, 2], "block": {"id": "minecraft:lava", "level": 0} }, + { + "at": 80, + "do": "assert", + "checks": [ + { "pos": [2, 1, 2], "is": {"id": "minecraft:stone"} } + ] + } + ] +} + diff --git a/tests/fluids/lava_soul_soil_blue_ice_basalt.json b/tests/fluids/lava_soul_soil_blue_ice_basalt.json new file mode 100644 index 0000000..80223ad --- /dev/null +++ b/tests/fluids/lava_soul_soil_blue_ice_basalt.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "lava_over_soul_soil_with_blue_ice_basalt", + "description": "Lava placed above soul_soil and adjacent to blue_ice converts to basalt. In shouldSpreadLiquid, lava over soul_soil touching blue_ice becomes basalt.", + "tags": ["interaction", "lava", "basalt", "soul_soil", "blue_ice"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [4, 3, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [4, 0, 4] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 0, "do": "place", "pos": [2, 0, 2], "block": {"id": "minecraft:soul_soil"} }, + { "at": 0, "do": "place", "pos": [3, 1, 2], "block": {"id": "minecraft:blue_ice"} }, + { "at": 1, "do": "place", "pos": [2, 1, 2], "block": {"id": "minecraft:lava", "level": 0} }, + { + "at": 5, + "do": "assert", + "checks": [ + { "pos": [2, 1, 2], "is": {"id": "minecraft:basalt"} } + ] + } + ] +} + diff --git a/tests/fluids/lava_source_meets_water_obsidian.json b/tests/fluids/lava_source_meets_water_obsidian.json new file mode 100644 index 0000000..8c5933c --- /dev/null +++ b/tests/fluids/lava_source_meets_water_obsidian.json @@ -0,0 +1,54 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "lava_source_meets_water_obsidian", + "description": "Lava source block touching water converts to obsidian. In shouldSpreadLiquid, source lava adjacent to water becomes obsidian.", + "tags": ["interaction", "lava", "water", "obsidian"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [4, 3, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [4, 0, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [4, 2, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 4], [4, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [4, 1, 0], [4, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 1, "do": "place", "pos": [2, 1, 2], "block": {"id": "minecraft:lava", "level": 0} }, + { "at": 2, "do": "place", "pos": [2, 1, 1], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 10, + "do": "assert", + "checks": [ + { "pos": [2, 1, 2], "is": {"id": "minecraft:obsidian"} } + ] + } + ] +} + diff --git a/tests/fluids/water/blocked_by_door.json b/tests/fluids/water/blocked_by_door.json new file mode 100644 index 0000000..ddb2245 --- /dev/null +++ b/tests/fluids/water/blocked_by_door.json @@ -0,0 +1,96 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_blocked_by_closed_door", + "description": "Water cannot flow through a closed door because DoorBlock is not a LiquidBlockContainer and is explicitly excluded in canHoldAnyFluid", + "tags": ["blocking", "door"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [6, 4, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [6, 0, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [6, 3, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 4], [6, 3, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 3, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [6, 1, 0], [6, 3, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [3, 1, 1], [3, 1, 3] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [3, 2, 1], [3, 2, 3] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "place_each", + "blocks": [ + { + "pos": [3, 1, 2], + "block": { + "id" : "minecraft:oak_door", + "half" : "lower" , + "facing" : "east" , + "hinge" : "left" , + "open" : "false" , + "powered": "false" + } + }, + { + "pos": [3, 2, 2], + "block": { + "id" : "minecraft:oak_door", + "half" : "upper" , + "facing" : "east" , + "hinge" : "left" , + "open" : "false" , + "powered": "false" + } + } + ] + }, + { "at": 1, "do": "place", "pos": [1, 1, 2], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 40, + "do": "assert", + "checks": [ + { "pos": [2, 1, 2], "is": {"id": "minecraft:water" } }, + { "pos": [3, 1, 2], "is": {"id": "minecraft:oak_door"} }, + { "pos": [4, 1, 2], "is": {"id": "minecraft:air" } }, + { "pos": [5, 1, 2], "is": {"id": "minecraft:air" } } + ] + } + ] +} + diff --git a/tests/fluids/water/blocked_by_structure_void.json b/tests/fluids/water/blocked_by_structure_void.json new file mode 100644 index 0000000..cac81bb --- /dev/null +++ b/tests/fluids/water/blocked_by_structure_void.json @@ -0,0 +1,62 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_blocked_by_structure_void", + "description": "Water cannot flow through structure_void blocks because they are explicitly excluded in canHoldAnyFluid even though they do not block motion", + "tags": ["blocking", "structure_void"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [6, 4, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [6, 0, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [6, 3, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 4], [6, 3, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 3, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [6, 1, 0], [6, 3, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [3, 1, 1], [3, 1, 3] ], + "with": {"id": "minecraft:structure_void"} + }, + { "at": 1, "do": "place", "pos": [1, 1, 2], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 40, + "do": "assert", + "checks": [ + { "pos": [2, 1, 2], "is": {"id": "minecraft:water" } }, + { "pos": [3, 1, 2], "is": {"id": "minecraft:structure_void"} }, + { "pos": [4, 1, 2], "is": {"id": "minecraft:air" } }, + { "pos": [5, 1, 2], "is": {"id": "minecraft:air" } } + ] + } + ] +} + diff --git a/tests/fluids/water/destroys_nonsolid_blocks.json b/tests/fluids/water/destroys_nonsolid_blocks.json new file mode 100644 index 0000000..f8bc614 --- /dev/null +++ b/tests/fluids/water/destroys_nonsolid_blocks.json @@ -0,0 +1,54 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_destroys_nonsolid_blocks_in_path", + "description": "Water flowing into a non-solid, non-waterloggable block destroys it and replaces it with water. From spreadTo(): if block is not LiquidBlockContainer and not air, beforeDestroyingBlock is called.", + "tags": ["destroy", "replace"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [6, 3, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [6, 0, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [6, 2, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 4], [6, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [6, 1, 0], [6, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 0, "do": "place", "pos": [3, 1, 2], "block": {"id": "minecraft:torch"} }, + { "at": 1, "do": "place", "pos": [1, 1, 2], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 30, + "do": "assert", + "checks": [ + { "pos": [3, 1, 2], "is": {"id": "minecraft:water"} } + ] + } + ] +} + diff --git a/tests/fluids/water/falling_resets_spread.json b/tests/fluids/water/falling_resets_spread.json new file mode 100644 index 0000000..0694e49 --- /dev/null +++ b/tests/fluids/water/falling_resets_spread.json @@ -0,0 +1,64 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_falling_resets_spread_level", + "description": "Water flowing at level 7 (amount=1) that falls off a cliff resets to amount=8, allowing 7 more blocks of horizontal spread at the bottom", + "tags": ["falling", "spread", "level"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [14, 6, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [14, 0, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 2, 0], [7, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [14, 5, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 4], [14, 5, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 5, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [14, 1, 0], [14, 5, 4] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 1, "do": "place", "pos": [1, 3, 2], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 80, + "do": "assert", + "checks": [ + { "pos": [ 1, 3, 2], "is": {"id": "minecraft:water", "level": "0"} }, + { "pos": [ 8, 3, 2], "is": {"id": "minecraft:water", "level": "7"} }, + { "pos": [ 8, 2, 2], "is": {"id": "minecraft:water", "level": "8"} }, + { "pos": [ 8, 1, 2], "is": {"id": "minecraft:water", "level": "8"} }, + { "pos": [ 9, 1, 2], "is": {"id": "minecraft:water", "level": "1"} }, + { "pos": [12, 1, 2], "is": {"id": "minecraft:water", "level": "4"} } + ] + } + ] +} + diff --git a/tests/fluids/water/flow_four_directions.json b/tests/fluids/water/flow_four_directions.json new file mode 100644 index 0000000..e7c41f3 --- /dev/null +++ b/tests/fluids/water/flow_four_directions.json @@ -0,0 +1,61 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_flow_four_directions", + "description": "Water source on a flat floor spreads equally in all four cardinal directions", + "tags": ["spread", "cardinal"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [10, 3, 10] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [10, 0, 10] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [10, 2, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 10], [10, 2, 10] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 2, 10] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [10, 1, 0], [10, 2, 10] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 1, "do": "place", "pos": [5, 1, 5], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 60, + "do": "assert", + "checks": [ + { "pos": [5, 1, 5], "is": {"id": "minecraft:water", "level": "0"} }, + { "pos": [6, 1, 5], "is": {"id": "minecraft:water", "level": "1"} }, + { "pos": [4, 1, 5], "is": {"id": "minecraft:water", "level": "1"} }, + { "pos": [5, 1, 6], "is": {"id": "minecraft:water", "level": "1"} }, + { "pos": [5, 1, 4], "is": {"id": "minecraft:water", "level": "1"} }, + { "pos": [7, 1, 5], "is": {"id": "minecraft:water", "level": "2"} }, + { "pos": [3, 1, 5], "is": {"id": "minecraft:water", "level": "2"} }, + { "pos": [5, 1, 7], "is": {"id": "minecraft:water", "level": "2"} }, + { "pos": [5, 1, 3], "is": {"id": "minecraft:water", "level": "2"} } + ] + } + ] +} + diff --git a/tests/fluids/water/flowing_over_hole_no_sideways.json b/tests/fluids/water/flowing_over_hole_no_sideways.json new file mode 100644 index 0000000..046044d --- /dev/null +++ b/tests/fluids/water/flowing_over_hole_no_sideways.json @@ -0,0 +1,64 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_flowing_over_hole_skips_sideways", + "description": "Non-source flowing water positioned over a hole (isWaterHole=true) does not spread sideways - it only flows down. From spread(): if not source and isWaterHole, spreadToSides is skipped.", + "tags": ["hole", "spread", "priority"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [6, 5, 6] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [6, 0, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 2, 0], [6, 2, 6] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 0, "do": "place", "pos": [3, 2, 3], "block": {"id": "minecraft:air"} }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [6, 4, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 6], [6, 4, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 4, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [6, 1, 0], [6, 4, 6] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 1, "do": "place", "pos": [2, 3, 3], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 40, + "do": "assert", + "checks": [ + { "pos": [3, 3, 3], "is": {"id": "minecraft:water", "level": "1"} }, + { "pos": [3, 1, 3], "is": {"id": "minecraft:water" } }, + { "pos": [4, 3, 3], "is": {"id": "minecraft:air" } }, + { "pos": [3, 3, 2], "is": {"id": "minecraft:air" } }, + { "pos": [3, 3, 4], "is": {"id": "minecraft:air" } } + ] + } + ] +} + diff --git a/tests/fluids/water/flowing_recalculates_level.json b/tests/fluids/water/flowing_recalculates_level.json new file mode 100644 index 0000000..a895d2a --- /dev/null +++ b/tests/fluids/water/flowing_recalculates_level.json @@ -0,0 +1,61 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_flowing_recalculates_level_on_tick", + "description": "Flowing water recalculates its level each tick based on neighbors. If a second source is added nearby, flowing water between two sources becomes a source (level 0) via getNewLiquid neighbourSources check.", + "tags": ["recalculate", "dynamic"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [6, 3, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [6, 0, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [6, 2, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 4], [6, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [6, 1, 0], [6, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 1, "do": "place", "pos": [1, 1, 2], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 20, + "do": "assert", + "checks": [ + { "pos": [2, 1, 2], "is": {"id": "minecraft:water", "level": "1"} } + ] + }, + { "at": 21, "do": "place", "pos": [3, 1, 2], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 40, + "do": "assert", + "checks": [ + { "pos": [2, 1, 2], "is": {"id": "minecraft:water", "level": "0"} } + ] + } + ] +} + diff --git a/tests/fluids/water/single_source_no_new_source.json b/tests/fluids/water/single_source_no_new_source.json new file mode 100644 index 0000000..82b22d0 --- /dev/null +++ b/tests/fluids/water/single_source_no_new_source.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_single_source_stays_flowing", + "description": "Flowing water adjacent to only one source block does not convert to a source. The getNewLiquid method requires neighbourSources >= 2 for source conversion.", + "tags": ["source", "conversion"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [6, 4, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [6, 0, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [6, 3, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 4], [6, 3, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 3, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [6, 1, 0], [6, 3, 4] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 1, "do": "place", "pos": [1, 1, 2], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 40, + "do": "assert", + "checks": [ + { "pos": [1, 1, 2], "is": {"id": "minecraft:water", "level": "0"} }, + { "pos": [2, 1, 2], "is": {"id": "minecraft:water", "level": "1"} }, + { "pos": [3, 1, 2], "is": {"id": "minecraft:water", "level": "2"} }, + { "pos": [4, 1, 2], "is": {"id": "minecraft:water", "level": "3"} }, + { "pos": [5, 1, 2], "is": {"id": "minecraft:water", "level": "4"} } + ] + } + ] +} + diff --git a/tests/fluids/water/slope_prefers_closer_hole.json b/tests/fluids/water/slope_prefers_closer_hole.json new file mode 100644 index 0000000..b209228 --- /dev/null +++ b/tests/fluids/water/slope_prefers_closer_hole.json @@ -0,0 +1,63 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_slope_prefers_closer_hole", + "description": "Water preferentially flows toward a closer drop-off over a further one. In getSpread(), when a direction has shorter slopeDistance, result.clear() removes longer paths and water only flows toward the closest hole.", + "tags": ["slope", "pathfinding"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [10, 4, 6] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [10, 0, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [10, 3, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 6], [10, 3, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 3, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [10, 1, 0], [10, 3, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [10, 1, 6] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 0, "do": "place", "pos": [3, 1, 3], "block": {"id": "minecraft:air"} }, + { "at": 0, "do": "place", "pos": [8, 1, 3], "block": {"id": "minecraft:air"} }, + { "at": 1, "do": "place", "pos": [5, 2, 3], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 40, + "do": "assert", + "checks": [ + { "pos": [4, 2, 3], "is": {"id": "minecraft:water"} }, + { "pos": [3, 2, 3], "is": {"id": "minecraft:water"} }, + { "pos": [6, 2, 3], "is": {"id": "minecraft:air" } } + ] + } + ] +} + diff --git a/tests/fluids/water/source_requires_solid_below.json b/tests/fluids/water/source_requires_solid_below.json new file mode 100644 index 0000000..e185930 --- /dev/null +++ b/tests/fluids/water/source_requires_solid_below.json @@ -0,0 +1,59 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_source_requires_solid_or_water_below", + "description": "Two adjacent source blocks only create a new source between them if the block below is solid or a water source. With air below the middle position, it stays as flowing water (level 1) instead of becoming a source (level 0).", + "tags": ["source", "conversion", "solid_below"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [4, 10, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [4, 10, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [1, 1, 1], [3, 1, 3] ], + "with": {"id": "minecraft:air"} + }, + { + "at": 0, + "do": "fill", + "region": [ [2, 2, 1], [2, 2, 3] ], + "with": {"id": "minecraft:air"} + }, + { + "at": 0, + "do": "place_each", + "blocks": [ + { "pos": [1, 2, 2], "block": {"id": "minecraft:air"} }, + { "pos": [3, 2, 2], "block": {"id": "minecraft:air"} }, + { "pos": [2, 2, 2], "block": {"id": "minecraft:air"} } + ] + }, + { + "at": 1, + "do": "place_each", + "blocks": [ + { "pos": [1, 2, 2], "block": {"id": "minecraft:water", "level": 0} }, + { "pos": [3, 2, 2], "block": {"id": "minecraft:water", "level": 0} } + ] + }, + { + "at": 20, + "do": "assert", + "checks": [ + { "pos": [1, 2, 2], "is": {"id": "minecraft:water", "level": "0"} }, + { "pos": [3, 2, 2], "is": {"id": "minecraft:water", "level": "0"} }, + { "pos": [2, 2, 2], "is": {"id": "minecraft:water", "level": "1"} } + ] + } + ] +} + diff --git a/tests/fluids/water/source_spreads_sideways_over_hole.json b/tests/fluids/water/source_spreads_sideways_over_hole.json new file mode 100644 index 0000000..c464ec5 --- /dev/null +++ b/tests/fluids/water/source_spreads_sideways_over_hole.json @@ -0,0 +1,64 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_source_spreads_sideways_over_hole", + "description": "A source block over a hole still spreads sideways, unlike flowing water. From spread(): sources always call spreadToSides (isSource=true bypasses the isWaterHole check).", + "tags": ["source", "hole", "spread"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [6, 5, 6] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [6, 0, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 2, 0], [6, 2, 6] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 0, "do": "place", "pos": [3, 2, 3], "block": {"id": "minecraft:air"} }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [6, 4, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 6], [6, 4, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 4, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [6, 1, 0], [6, 4, 6] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 1, "do": "place", "pos": [3, 3, 3], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 30, + "do": "assert", + "checks": [ + { "pos": [3, 1, 3], "is": {"id": "minecraft:water"} }, + { "pos": [4, 3, 3], "is": {"id": "minecraft:water"} }, + { "pos": [2, 3, 3], "is": {"id": "minecraft:water"} }, + { "pos": [3, 3, 4], "is": {"id": "minecraft:water"} }, + { "pos": [3, 3, 2], "is": {"id": "minecraft:water"} } + ] + } + ] +} + diff --git a/tests/fluids/water/stopped_by_solid.json b/tests/fluids/water/stopped_by_solid.json new file mode 100644 index 0000000..4a25ceb --- /dev/null +++ b/tests/fluids/water/stopped_by_solid.json @@ -0,0 +1,61 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_stopped_by_solid_block", + "description": "Water flow is blocked by solid blocks (blocksMotion=true). Water accumulates against the wall but does not pass through.", + "tags": ["blocking", "solid"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [6, 3, 4] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [6, 0, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [6, 2, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 4], [6, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [6, 1, 0], [6, 2, 4] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [3, 1, 1], [3, 2, 3] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 1, "do": "place", "pos": [1, 1, 2], "block": {"id": "minecraft:water", "level": 0} }, + { + "at": 30, + "do": "assert", + "checks": [ + { "pos": [2, 1, 2], "is": {"id": "minecraft:water"} }, + { "pos": [4, 1, 2], "is": {"id": "minecraft:air" } }, + { "pos": [5, 1, 2], "is": {"id": "minecraft:air" } } + ] + } + ] +} + diff --git a/tests/fluids/water/three_sources_spread_while_falling.json b/tests/fluids/water/three_sources_spread_while_falling.json new file mode 100644 index 0000000..feeef76 --- /dev/null +++ b/tests/fluids/water/three_sources_spread_while_falling.json @@ -0,0 +1,70 @@ +{ + "$schema": "https://raw.githubusercontent.com/FlintTestMC/flint-core/refs/heads/main/flint-content/test_spec_schema.json", + "name": "water_three_source_neighbors_spread_while_falling", + "description": "When water spreads downward AND has 3+ source neighbors, it also spreads sideways in the same tick. From spread(): sourceNeighborCount >= 3 triggers spreadToSides even when flowing down.", + "tags": ["source", "falling", "spread"], + "dependencies": [], + "setup": { + "cleanup": { + "region": [ [0, 0, 0], [6, 5, 6] ] + } + }, + "timeline": [ + { + "at": 0, + "do": "fill", + "region": [ [0, 0, 0], [6, 0, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 2, 0], [6, 2, 6] ], + "with": {"id": "minecraft:stone"} + }, + { "at": 0, "do": "place", "pos": [3, 2, 3], "block": {"id": "minecraft:air"} }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [6, 4, 0] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 6], [6, 4, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [0, 1, 0], [0, 4, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 0, + "do": "fill", + "region": [ [6, 1, 0], [6, 4, 6] ], + "with": {"id": "minecraft:stone"} + }, + { + "at": 1, + "do": "place_each", + "blocks": [ + { "pos": [2, 3, 3], "block": {"id": "minecraft:water", "level": 0} }, + { "pos": [4, 3, 3], "block": {"id": "minecraft:water", "level": 0} }, + { "pos": [3, 3, 2], "block": {"id": "minecraft:water", "level": 0} } + ] + }, + { + "at": 30, + "do": "assert", + "checks": [ + { "pos": [3, 3, 3], "is": {"id": "minecraft:water", "level": "1"} }, + { "pos": [3, 1, 3], "is": {"id": "minecraft:water" } }, + { "pos": [3, 3, 4], "is": {"id": "minecraft:water" } } + ] + } + ] +} +