Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.
Rust differential-testinggame-enginegamedevlinuxminecraftminecraft-javareimplementationrustvoxelvulkanwgpu
Merge remote-tracking branch 'origin/main' into optifine/ctm-chained
some-du6e8086d137e551
diff --cc crates/horizon-client-render/src/connected.rsindex a37568ce7,eec6572df..aefcc592e--- a/crates/horizon-client-render/src/connected.rs+++ b/crates/horizon-client-render/src/connected.rs@@@ -1012,40 -1039,51 +1073,85 @@@ mod testsassert_eq!((layers, pick), (vec![1001, 3000], Pick::Keep));}+ #[test]+ fn a_picked_tile_can_be_picked_again() {+ // b (rule 1) gives glass its tile b0, layer 2000; t (rule 0, a tile rule, tried first)+ // names that tile, so it draws in b0's place.+ let chain = |t: &str| {+ world(&[+ ("b.properties", "matchBlocks=glass\nmethod=fixed\ntiles=b0"),+ ("t.properties", t),+ ])+ };+ let ctm = chain("matchTiles=optifine/ctm/b0.png\nmethod=fixed\ntiles=0");+ assert_eq!(pick_in(&ctm, 1, 3, Face::Up, &[]), tile(1000));+ // A chained rule keeping the tile (<default>) leaves b's.+ let ctm = chain("matchTiles=optifine/ctm/b0.png\nmethod=fixed\ntiles=<default>");+ assert_eq!(pick_in(&ctm, 1, 3, Face::Up, &[]), tile(2000));+ // One that names another block doesn't chain on glass.+ let ctm = chain("matchTiles=optifine/ctm/b0.png\nmatchBlocks=stone\nmethod=fixed\ntiles=0");+ assert_eq!(pick_in(&ctm, 1, 3, Face::Up, &[]), tile(2000));+ // An overlay tried on the face's own sprite and on the picked tile draws once.+ let ctm = chain("matchTiles=glass optifine/ctm/b0.png\nmethod=overlay_fixed\ntiles=0");+ let (overlays, pick) = overlays_in(&ctm, 1, Face::Up, &[]);+ assert_eq!((overlays, pick), (vec![1000], tile(2000)));+ // A rule after the one that picked, naming both the face's sprite and the tile, wasn't+ // tried: it chains.+ let ctm = world(&[+ ("a.properties", "matchTiles=glass\nmethod=fixed\ntiles=a0"),+ (+ "c.properties",+ "matchTiles=glass optifine/ctm/a0.png\nmethod=fixed\ntiles=0",+ ),+ ]);+ assert_eq!(pick_in(&ctm, 1, 3, Face::Up, &[]), tile(2000));+ }++ #[test]+ fn stacked_panes_hide_the_strips_they_share() {+ let props = |pairs: &[(&str, &str)]| -> BlockProperties {+ pairs+ .iter()+ .map(|(k, v)| (k.to_string(), v.to_string()))+ .collect()+ };+ // 0 a pane with north and east arms, 1 the same pane with only a north arm, 2 another+ // pane block, 3 a pane no rule names.+ let states = [+ (+ "minecraft:glass_pane",+ props(&[("north", "true"), ("east", "true")]),+ ),+ ("minecraft:glass_pane", props(&[("north", "true")])),+ (+ "minecraft:white_stained_glass_pane",+ props(&[("north", "true")]),+ ),+ ("minecraft:iron_bars", props(&[("north", "true")])),+ ];+ let ctm = ConnectedTextures::build(+ rules(&[(+ "pane.properties",+ "matchBlocks=glass_pane white_stained_glass_pane\nmethod=ctm\ntiles=0-46",+ )]),+ states.iter().map(|(n, p)| Some((*n, p))),+ |_| None,+ );+ let (post, north, east) = ([0.5, 0.5], [0.5, 0.2], [0.8, 0.5]);+ assert!(ctm.stacked_pane_hides(0, 1, post));+ assert!(ctm.stacked_pane_hides(0, 1, north));+ // The pane above has no east arm: the strip shows; one with it hides it.+ assert!(!ctm.stacked_pane_hides(0, 1, east));+ assert!(ctm.stacked_pane_hides(1, 0, east));+ let (south, west) = ([0.5, 0.8], [0.2, 0.5]);+ assert!(!ctm.stacked_pane_hides(1, 0, south));+ assert!(!ctm.stacked_pane_hides(1, 0, west));+ assert!(ctm.stacked_pane_hides(1, 0, north));+ // Another block, or a pane without rules, hides nothing.+ assert!(!ctm.stacked_pane_hides(1, 2, post));+ assert!(!ctm.stacked_pane_hides(3, 3, post));+ }+#[test]fn sprite_names() {assert_eq!(