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
Portals carry thrown tridents and firework rockets
HrafnaValkyrjadea101aafb24
diff --git a/crates/horizon-client/src/game/nether_portal.rs b/crates/horizon-client/src/game/nether_portal.rsindex 190aa66fe..92c1d5309 100644--- a/crates/horizon-client/src/game/nether_portal.rs+++ b/crates/horizon-client/src/game/nether_portal.rs@@ -734,6 +734,16 @@ impl Game<'_> {ids.push((o.id, true));}}+ for t in &self.tridents {+ if tracked.contains_key(&t.id) {+ ids.push((t.id, true));+ }+ }+ for r in &self.rockets {+ if tracked.contains_key(&r.id) && r.attached_to.is_none() && !r.attached {+ ids.push((r.id, true));+ }+ }}let present: std::collections::HashSet<u32> = ids.iter().map(|(id, _)| *id).collect();self.portals.entities.retain(|id, _| present.contains(id));@@ -921,6 +931,30 @@ impl Game<'_> {inside.push((p.id, pos));}}+ // A trident (0.5 across) or rocket (0.25) in flight, or one that moved+ // this tick; a rocket that carries its owner stays.+ let mut flyers: Vec<(u32, Vec3, Vec3, f32)> = Vec::new();+ for t in self+ .tridents+ .iter_mut()+ .filter(|t| !t.in_ground || t.previous != t.position)+ {+ let id = super::lan_entities::assign_entity_id(&mut self.next_entity, &mut t.id);+ flyers.push((id, t.previous, t.position, 0.5));+ }+ for r in self+ .rockets+ .iter_mut()+ .filter(|r| r.attached_to.is_none() && !r.attached)+ {+ let id = super::lan_entities::assign_entity_id(&mut self.next_entity, &mut r.id);+ flyers.push((id, r.previous, r.position, 0.25));+ }+ for (id, from, to, size) in flyers {+ if let Some(pos) = self.swept_portal(from, to, size, size, &mut portal_sections) {+ inside.push((id, pos));+ }+ }self.portals.sections = portal_sections;for (id, pos) in inside {self.portals@@ -1058,6 +1092,28 @@ impl Game<'_> {self.forget_entity(id);self.portals.arrivals.push(Arrival { plan, tag });self.portals.dirty = true;+ } else if let Some(i) = self.tridents.iter().position(|t| t.id == id) {+ let plan = self.entity_plan(entry, self.tridents[i].position, 0.5, 0.5, false);+ if !self.may_enter(plan.dim) {+ return;+ }+ let uuid = self.uuid_for(id);+ let tag = self.tridents[i].to_nbt(uuid, self.persist_raw(id));+ self.tridents.remove(i);+ self.forget_entity(id);+ self.portals.arrivals.push(Arrival { plan, tag });+ self.portals.dirty = true;+ } else if let Some(i) = self.rockets.iter().position(|r| r.id == id) {+ let plan = self.entity_plan(entry, self.rockets[i].position, 0.25, 0.25, false);+ if !self.may_enter(plan.dim) {+ return;+ }+ let uuid = self.uuid_for(id);+ let tag = self.rockets[i].to_nbt(uuid, self.level.player_uuid, self.persist_raw(id));+ self.rockets.remove(i);+ self.forget_entity(id);+ self.portals.arrivals.push(Arrival { plan, tag });+ self.portals.dirty = true;} else if let Some(i) = self.orbs.iter().position(|o| o.id == id) {let plan = self.entity_plan(entry, self.orbs[i].position, 0.5, 0.5, false);if !self.may_enter(plan.dim) {diff --git a/crates/horizon-client/src/game/persist.rs b/crates/horizon-client/src/game/persist.rsindex 7082adcbd..feb7a017b 100644--- a/crates/horizon-client/src/game/persist.rs+++ b/crates/horizon-client/src/game/persist.rs@@ -452,13 +452,20 @@ impl Game<'_> {}"minecraft:trident" => {if let Some(n) = entity_nbt::trident_from_nbt(&tag) {- self.tridents- .push(super::trident::ThrownTrident::from_nbt(n));+ let mut t = super::trident::ThrownTrident::from_nbt(n);+ // One that came through a portal keeps its cooldown.+ super::lan_entities::assign_entity_id(&mut self.next_entity, &mut t.id);+ self.restore_portal_cooldown(t.id, &tag);+ self.tridents.push(t);}}"minecraft:firework_rocket" => {if let Some(r) = entity_nbt::firework_rocket_from_nbt(&tag, player_uuid) {- self.rockets.push(super::fireworks::Rocket::from_nbt(r));+ let mut r = super::fireworks::Rocket::from_nbt(r);+ // One that came through a portal keeps its cooldown.+ super::lan_entities::assign_entity_id(&mut self.next_entity, &mut r.id);+ self.restore_portal_cooldown(r.id, &tag);+ self.rockets.push(r);}}// PrimedTnt.readAdditionalSaveData: its fuse (80 when absent) and motion.