mirror of
https://github.com/italicsjenga/valence.git
synced 2025-01-09 14:21:30 +11:00
* Set time of day #55 * fix typo * Update src/client.rs Co-authored-by: Ryan Johnson <ryanj00a@gmail.com> * format file Co-authored-by: Ryan Johnson <ryanj00a@gmail.com>
This commit is contained in:
parent
77ad1dfdd1
commit
eed39364df
|
@ -35,7 +35,7 @@ use crate::protocol::packets::s2c::play::{
|
|||
SetEntityVelocity, SetExperience, SetHeadRotation, SetHealth, SetRenderDistance,
|
||||
SetSubtitleText, SetTitleText, SoundCategory, SynchronizePlayerPosition, SystemChatMessage,
|
||||
TeleportEntity, UnloadChunk, UpdateAttributes, UpdateEntityPosition,
|
||||
UpdateEntityPositionAndRotation, UpdateEntityRotation,
|
||||
UpdateEntityPositionAndRotation, UpdateEntityRotation, UpdateTime,
|
||||
};
|
||||
use crate::protocol::{BoundedInt, BoundedString, ByteAngle, NbtBridge, RawBytes, VarInt};
|
||||
use crate::server::{C2sPacketChannels, NewClientData, S2cPlayMessage, SharedServer};
|
||||
|
@ -673,6 +673,17 @@ impl<C: Config> Client<C> {
|
|||
});
|
||||
}
|
||||
|
||||
/// Sets the world_age and the current in-game time.
|
||||
///
|
||||
/// To stop time from passing, the `time_of_day` parameter must be
|
||||
/// negative. The client stops the time at the absolute value.
|
||||
pub fn set_time(&mut self, world_age: i64, time_of_day: i64) {
|
||||
self.send_packet(UpdateTime {
|
||||
world_age,
|
||||
time_of_day,
|
||||
});
|
||||
}
|
||||
|
||||
/// Gets the client's current settings.
|
||||
pub fn settings(&self) -> Option<&Settings> {
|
||||
self.settings.as_ref()
|
||||
|
|
Loading…
Reference in a new issue