diff options
| author | mat <github@matdoes.dev> | 2022-06-25 02:33:28 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-06-25 02:33:28 -0500 |
| commit | cd9a05e5a62190b3d4a2a733bf637d6324aec5fd (patch) | |
| tree | 15fb360678dfb5e8d81330144b810735b73f6ef4 /azalea-core/src | |
| parent | c9faf25fab4f89319731fec87ad4d2cf45864632 (diff) | |
| download | azalea-drasl-cd9a05e5a62190b3d4a2a733bf637d6324aec5fd.tar.xz | |
read_into -> read_from
yeah
Diffstat (limited to 'azalea-core/src')
| -rwxr-xr-x | azalea-core/src/difficulty.rs | 4 | ||||
| -rwxr-xr-x | azalea-core/src/game_type.rs | 8 | ||||
| -rw-r--r-- | azalea-core/src/particle/mod.rs | 18 | ||||
| -rw-r--r-- | azalea-core/src/position.rs | 14 | ||||
| -rwxr-xr-x | azalea-core/src/resource_location.rs | 6 | ||||
| -rw-r--r-- | azalea-core/src/slot.rs | 6 |
6 files changed, 28 insertions, 28 deletions
diff --git a/azalea-core/src/difficulty.rs b/azalea-core/src/difficulty.rs index ebbb7708..718359f3 100755 --- a/azalea-core/src/difficulty.rs +++ b/azalea-core/src/difficulty.rs @@ -67,8 +67,8 @@ impl Difficulty { } impl McBufReadable for Difficulty { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - Ok(Difficulty::by_id(u8::read_into(buf)?)) + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + Ok(Difficulty::by_id(u8::read_from(buf)?)) } } diff --git a/azalea-core/src/game_type.rs b/azalea-core/src/game_type.rs index 67c392b2..d41e5b84 100755 --- a/azalea-core/src/game_type.rs +++ b/azalea-core/src/game_type.rs @@ -77,8 +77,8 @@ impl GameType { } impl McBufReadable for GameType { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - GameType::from_id(u8::read_into(buf)?) + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + GameType::from_id(u8::read_from(buf)?) } } @@ -105,8 +105,8 @@ impl From<OptionalGameType> for Option<GameType> { } impl McBufReadable for OptionalGameType { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - GameType::from_optional_id(i8::read_into(buf)?) + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + GameType::from_optional_id(i8::read_from(buf)?) } } diff --git a/azalea-core/src/particle/mod.rs b/azalea-core/src/particle/mod.rs index 6eb53955..3b2e9807 100644 --- a/azalea-core/src/particle/mod.rs +++ b/azalea-core/src/particle/mod.rs @@ -157,8 +157,8 @@ impl ParticleData { Ok(match id { 0 => ParticleData::AmbientEntityEffect, 1 => ParticleData::AngryVillager, - 2 => ParticleData::Block(BlockParticle::read_into(buf)?), - 3 => ParticleData::BlockMarker(BlockParticle::read_into(buf)?), + 2 => ParticleData::Block(BlockParticle::read_from(buf)?), + 3 => ParticleData::BlockMarker(BlockParticle::read_from(buf)?), 4 => ParticleData::Bubble, 5 => ParticleData::Cloud, 6 => ParticleData::Crit, @@ -169,8 +169,8 @@ impl ParticleData { 11 => ParticleData::LandingLava, 12 => ParticleData::DrippingWater, 13 => ParticleData::FallingWater, - 14 => ParticleData::Dust(DustParticle::read_into(buf)?), - 15 => ParticleData::DustColorTransition(DustColorTransitionParticle::read_into(buf)?), + 14 => ParticleData::Dust(DustParticle::read_from(buf)?), + 15 => ParticleData::DustColorTransition(DustColorTransitionParticle::read_from(buf)?), 16 => ParticleData::Effect, 17 => ParticleData::ElderGuardian, 18 => ParticleData::EnchantedHit, @@ -179,7 +179,7 @@ impl ParticleData { 21 => ParticleData::EntityEffect, 22 => ParticleData::ExplosionEmitter, 23 => ParticleData::Explosion, - 24 => ParticleData::FallingDust(BlockParticle::read_into(buf)?), + 24 => ParticleData::FallingDust(BlockParticle::read_from(buf)?), 25 => ParticleData::Firework, 26 => ParticleData::Fishing, 27 => ParticleData::Flame, @@ -190,8 +190,8 @@ impl ParticleData { 32 => ParticleData::Composter, 33 => ParticleData::Heart, 34 => ParticleData::InstantEffect, - 35 => ParticleData::Item(ItemParticle::read_into(buf)?), - 36 => ParticleData::Vibration(VibrationParticle::read_into(buf)?), + 35 => ParticleData::Item(ItemParticle::read_from(buf)?), + 36 => ParticleData::Vibration(VibrationParticle::read_from(buf)?), 37 => ParticleData::ItemSlime, 38 => ParticleData::ItemSnowball, 39 => ParticleData::LargeSmoke, @@ -249,8 +249,8 @@ impl ParticleData { } impl McBufReadable for ParticleData { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let id = u32::var_read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let id = u32::var_read_from(buf)?; ParticleData::read_from_particle_id(buf, id) } } diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs index de8e2516..195558e8 100644 --- a/azalea-core/src/position.rs +++ b/azalea-core/src/position.rs @@ -225,8 +225,8 @@ impl From<&EntityPos> for ChunkPos { } impl McBufReadable for BlockPos { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let val = u64::read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let val = u64::read_from(buf)?; let x = (val >> 38) as i32; let y = (val & 0xFFF) as i32; let z = ((val >> 12) & 0x3FFFFFF) as i32; @@ -235,17 +235,17 @@ impl McBufReadable for BlockPos { } impl McBufReadable for GlobalPos { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { + fn read_from(buf: &mut impl Read) -> Result<Self, String> { Ok(GlobalPos { - dimension: ResourceLocation::read_into(buf)?, - pos: BlockPos::read_into(buf)?, + dimension: ResourceLocation::read_from(buf)?, + pos: BlockPos::read_from(buf)?, }) } } impl McBufReadable for ChunkSectionPos { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let long = i64::read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let long = i64::read_from(buf)?; Ok(ChunkSectionPos { x: (long >> 42) as i32, y: (long << 44 >> 44) as i32, diff --git a/azalea-core/src/resource_location.rs b/azalea-core/src/resource_location.rs index acca0c58..945b6d80 100755 --- a/azalea-core/src/resource_location.rs +++ b/azalea-core/src/resource_location.rs @@ -46,8 +46,8 @@ impl std::fmt::Debug for ResourceLocation { } impl McBufReadable for ResourceLocation { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let location_string = String::read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let location_string = String::read_from(buf)?; ResourceLocation::new(&location_string) } } @@ -99,7 +99,7 @@ mod tests { let mut buf = Cursor::new(buf); assert_eq!( - ResourceLocation::read_into(&mut buf).unwrap(), + ResourceLocation::read_from(&mut buf).unwrap(), ResourceLocation::new("minecraft:dirt").unwrap() ); } diff --git a/azalea-core/src/slot.rs b/azalea-core/src/slot.rs index 6e622872..8b1f784d 100644 --- a/azalea-core/src/slot.rs +++ b/azalea-core/src/slot.rs @@ -18,12 +18,12 @@ pub struct SlotData { } impl McBufReadable for Slot { - fn read_into(buf: &mut impl Read) -> Result<Self, String> { - let present = bool::read_into(buf)?; + fn read_from(buf: &mut impl Read) -> Result<Self, String> { + let present = bool::read_from(buf)?; if !present { return Ok(Slot::Empty); } - let slot = SlotData::read_into(buf)?; + let slot = SlotData::read_from(buf)?; Ok(Slot::Present(slot)) } } |
