Trait ClientViewClientHost
pub trait ClientViewClientHost {
Show 15 methods
// Provided methods
fn hud_mode(&self) -> HudMode { ... }
fn set_hud_mode(&mut self, mode: HudMode) { ... }
fn camera_type(&self) -> CameraType { ... }
fn set_camera_type(&self, camera_type: CameraType) { ... }
fn is_paused(&self) -> bool { ... }
fn clock(&self) -> Option<Clock> { ... }
fn raycast(&self, distance: f32) -> Option<Hit> { ... }
fn view_hit(&self) -> Option<(f32, Hit)> { ... }
fn camera(&self) -> Option<Camera> { ... }
fn camera_entity(&self) -> Option<EntityRef> { ... }
fn client_surface_heights(
&self,
columns: &[(i32, i32)],
heightmap: Heightmap,
) -> Result<Vec<Option<i32>>, String> { ... }
fn set_camera_entity(&mut self, entity: EntityRef) -> bool { ... }
fn crosshair_target(&self) -> Option<CrosshairTarget> { ... }
fn targeting(&self) -> ClientTargeting { ... }
fn set_targeting(&self, targeting: ClientTargeting) -> bool { ... }
}Expand description
The client host’s methods of the client_view area, implemented by the game and reached through crate::ClientHost.
Provided Methods§
fn hud_mode(&self) -> HudMode
fn hud_mode(&self) -> HudMode
Side: client. Read effective HUD visibility independently of first-person hands.
fn set_hud_mode(&mut self, mode: HudMode)
fn set_hud_mode(&mut self, mode: HudMode)
Side: client. Select HUD and hand visibility, including after vanilla F1 input handling. Other first-person hand restrictions and render cancellation still apply.
fn camera_type(&self) -> CameraType
fn camera_type(&self) -> CameraType
Side: client.
The window’s camera type (Options.getCameraType), including its latest pending request.
fn set_camera_type(&self, camera_type: CameraType)
fn set_camera_type(&self, camera_type: CameraType)
Side: client.
Request the window’s camera type without cycling, also from shared-host callbacks.
The last request wins and Self::camera_type reports it immediately. Requests before
or during camera_pose apply to that frame’s camera, FOV and spectator post effects;
later requests apply at the next frame’s camera extraction. Explicit pose overrides
remain unchanged when vanilla placement is refreshed. No cycle hook is emitted.
fn is_paused(&self) -> bool
fn is_paused(&self) -> bool
Side: client. The applied client pause state, not whether a pause screen is open.
fn clock(&self) -> Option<Clock>
fn clock(&self) -> Option<Clock>
Side: client.
The clock of the world this window shows, for client mods: its game
time and time of day as the server last sent them
(ClientboundSetTimePacket), advanced each tick between packets; none
on the title screen.
fn raycast(&self, distance: f32) -> Option<Hit>
fn raycast(&self, distance: f32) -> Option<Hit>
Side: client.
The first block along the view within distance (at most 1024), past the loaded chunks over the distant terrain.
fn view_hit(&self) -> Option<(f32, Hit)>
fn view_hit(&self) -> Option<(f32, Hit)>
Side: client.
The first block along the view within RAYCAST_MAX, and its distance.
fn camera(&self) -> Option<Camera>
fn camera(&self) -> Option<Camera>
Side: client. The most recently extracted world frame’s camera, if one exists. During GUI rendering this is the current frame, including bob/spin and FOV.
fn camera_entity(&self) -> Option<EntityRef>
fn camera_entity(&self) -> Option<EntityRef>
Side: client.
The entity the view follows (Minecraft.getCameraEntity): the entity a server attached
the camera to, else the local player. None outside a client world.
fn client_surface_heights(
&self,
columns: &[(i32, i32)],
heightmap: Heightmap,
) -> Result<Vec<Option<i32>>, String>
fn client_surface_heights( &self, columns: &[(i32, i32)], heightmap: Heightmap, ) -> Result<Vec<Option<i32>>, String>
Side: client.
Each column’s height by heightmap in the world this window shows
(LevelReader.getHeight(type, x, z) on a client level): one above the highest block that
counts on that map, from the blocks the server has sent, none for a column whose chunk this
client does not hold. Err, reading nothing, for no client world (the title screen) or more
than 65,536 columns (MAX_COLUMNS).
fn set_camera_entity(&mut self, entity: EntityRef) -> bool
fn set_camera_entity(&mut self, entity: EntityRef) -> bool
Side: client.
Points the view at entity (Minecraft.setCameraEntity), as a server’s camera packet
does; the local player’s own ref puts it back. True when the view now follows it; false,
with nothing changed, for a stale ref, an entity this window is not shown, or one the
camera cannot follow (only the local player and mobs). While the view is off the player,
the player sends no moves (LocalPlayer.isControlledCamera). When the camera entity is
removed, the view returns to the local player. A mod can also release the view by calling
this with the player’s ref; this client-only selection does not notify the server.
fn crosshair_target(&self) -> Option<CrosshairTarget>
fn crosshair_target(&self) -> Option<CrosshairTarget>
Side: client. The ordinary block-or-entity pick (Minecraft.hitResult), using the game’s targeting ray, reach and occlusion. None without a client world or on a miss. Entity hits carry this client level’s epoch. Unlike native_view_hit, this never traces distant terrain.
fn targeting(&self) -> ClientTargeting
fn targeting(&self) -> ClientTargeting
Side: client. Current targeting controls. Stale entity overrides are omitted. Reach comes from the player’s vanilla interaction-range attributes, including server and equipment modifiers.
fn set_targeting(&self, targeting: ClientTargeting) -> bool
fn set_targeting(&self, targeting: ClientTargeting) -> bool
Side: client. Set the window’s targeting controls for subsequent picks. False, without changing any control, outside a client world or for a stale/self entity. Entity range, item attack range and (unless enabled here) occlusion are checked again when attacking. This does not change server reach checks or attack cooldowns. None clears an entity override.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".