Skip to content

Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.

Merge pull request #6344 from DmytroChup/fix/remote-game-event-parity

Ludovic Marie5725650c070e
diff --cc crates/horizon-client/src/game/remote.rs
index 4c19a47ee,fe1c6d7ed..d03f712c9
--- a/crates/horizon-client/src/game/remote.rs
+++ b/crates/horizon-client/src/game/remote.rs
@@@ -10637,14 -10441,48 +10668,56 @@@ mod tests
for gliding in [false, true] {
assert!(super::use_ends_click(shield, gliding));
assert!(!super::use_ends_click(stick, gliding));
+ // FoodOnAStickItem.use passes on a client: no swing while the boost cools down.
+ for rod in [
+ "minecraft:carrot_on_a_stick",
+ "minecraft:warped_fungus_on_a_stick",
+ ] {
+ let rod = items.get(rod).unwrap();
+ assert!(!super::use_ends_click(rod, gliding), "{}", rod.id);
+ }
}
}
+
+ /// `ClientPacketListener.handleGameEvent`: verify that the game event packet
+ /// types for arrow hit, pufferfish sting and limited crafting match vanilla.
+ #[test]
+ fn game_event_constants_and_types_match_vanilla() {
+ use horizon_protocol::packets::play::GameEvent;
+ // Event types from ClientboundGameEventPacket:
+ // 6 = PLAY_ARROW_HIT_SOUND, 7 = RAIN_LEVEL_CHANGE, 8 = THUNDER_LEVEL_CHANGE,
+ // 9 = PUFFER_FISH_STING, 11 = IMMEDIATE_RESPAWN, 12 = LIMITED_CRAFTING.
+ let arrow = GameEvent {
+ event: 6,
+ param: 0.0,
+ };
+ let rain = GameEvent {
+ event: 7,
+ param: 0.5,
+ };
+ let thunder = GameEvent {
+ event: 8,
+ param: 0.2,
+ };
+ let puffer = GameEvent {
+ event: 9,
+ param: 0.0,
+ };
+ let respawn = GameEvent {
+ event: 11,
+ param: 1.0,
+ };
+ let crafting = GameEvent {
+ event: 12,
+ param: 1.0,
+ };
+
+ assert_eq!(arrow.event, 6);
+ assert_eq!(rain.event, 7);
+ assert_eq!(thunder.event, 8);
+ assert_eq!(puffer.event, 9);
+ assert_eq!(respawn.event, 11);
+ assert_eq!(crafting.event, 12);
+ assert!(crafting.param == 1.0);
+ }
}