Update to Rust edition 2024

This commit is contained in:
Alexander Medvedev 2025-02-20 18:42:20 +01:00
parent b428fdca1a
commit 1fb2be46d4
208 changed files with 483 additions and 460 deletions

View File

@ -14,7 +14,7 @@ members = [
[workspace.package]
version = "0.1.0"
edition = "2021"
edition = "2024"
[profile.dev]

View File

@ -2,7 +2,7 @@
name = "pumpkin-fuzz"
version = "0.0.0"
publish = false
edition = "2021"
edition = "2024"
[package.metadata]
cargo-fuzz = true

View File

@ -2,7 +2,7 @@ use proc_macro::TokenStream;
use quote::quote;
use std::sync::LazyLock;
use std::sync::Mutex;
use syn::{parse_macro_input, parse_quote, ImplItem, ItemFn, ItemImpl, ItemStruct};
use syn::{ImplItem, ItemFn, ItemImpl, ItemStruct, parse_macro_input, parse_quote};
static PLUGIN_METHODS: LazyLock<Mutex<Vec<String>>> = LazyLock::new(|| Mutex::new(Vec::new()));

View File

@ -2,7 +2,7 @@ use chunk::ChunkConfig;
use log::warn;
use logging::LoggingConfig;
use pumpkin_util::{Difficulty, GameMode, PermissionLvl};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use serde::{Deserialize, Serialize, de::DeserializeOwned};
use std::{
env, fs,
@ -184,14 +184,15 @@ impl LoadConfiguration for BasicConfiguration {
}
fn validate(&self) {
let min = unsafe { NonZeroU8::new_unchecked(2) };
let max = unsafe { NonZeroU8::new_unchecked(32) };
assert!(
self.view_distance
.ge(unsafe { &NonZeroU8::new_unchecked(2) }),
self.view_distance.ge(&min),
"View distance must be at least 2"
);
assert!(
self.view_distance
.le(unsafe { &NonZeroU8::new_unchecked(32) }),
self.view_distance.le(&max),
"View distance must be less than 32"
);
if self.online_mode {

View File

@ -1,7 +1,7 @@
use std::collections::HashMap;
use proc_macro2::TokenStream;
use quote::{format_ident, quote, ToTokens};
use quote::{ToTokens, format_ident, quote};
use serde::Deserialize;
use syn::LitInt;

View File

@ -1,6 +1,6 @@
use heck::ToShoutySnakeCase;
use proc_macro2::{Span, TokenStream};
use quote::{format_ident, quote, ToTokens};
use quote::{ToTokens, format_ident, quote};
use syn::{Ident, LitBool, LitFloat, LitInt, LitStr};
include!("../src/tag.rs");

View File

@ -1,8 +1,8 @@
use pumpkin_data::{
item::Item,
tag::{get_tag_values, RegistryEntryList, RegistryKey, TagType},
tag::{RegistryEntryList, RegistryKey, TagType, get_tag_values},
};
use pumpkin_registry::{flatten_3x3, RecipeResult, RECIPES};
use pumpkin_registry::{RECIPES, RecipeResult, flatten_3x3};
use pumpkin_world::item::ItemStack;
use rayon::prelude::*;

View File

@ -1,5 +1,5 @@
use crate::crafting::check_if_matches_crafting;
use crate::Container;
use crate::crafting::check_if_matches_crafting;
use pumpkin_data::screen::WindowType;
use pumpkin_util::math::position::BlockPos;
use pumpkin_world::block::registry::Block;
@ -34,11 +34,7 @@ impl OpenContainer {
pub fn remove_player(&mut self, player_id: i32) {
if let Some(index) = self.players.iter().enumerate().find_map(|(index, id)| {
if *id == player_id {
Some(index)
} else {
None
}
if *id == player_id { Some(index) } else { None }
}) {
self.players.remove(index);
}

View File

@ -1,6 +1,6 @@
use crate::container_click::MouseClick;
use crate::crafting::check_if_matches_crafting;
use crate::{handle_item_change, Container, InventoryError, WindowType};
use crate::{Container, InventoryError, WindowType, handle_item_change};
use pumpkin_data::item::Item;
use pumpkin_world::item::ItemStack;
use std::iter::Chain;

View File

@ -3,8 +3,9 @@ use proc_macro::TokenStream;
use pumpkin_data::item::Item;
use quote::quote;
use syn::{
Block, Expr, Field, Fields, ItemStruct, Stmt,
parse::{Nothing, Parser},
parse_macro_input, Block, Expr, Field, Fields, ItemStruct, Stmt,
parse_macro_input,
};
extern crate proc_macro;
@ -161,14 +162,14 @@ pub fn client_packet(input: TokenStream, item: TokenStream) -> TokenStream {
let input: proc_macro2::TokenStream = input.into();
let item: proc_macro2::TokenStream = item.into();
let gen = quote! {
let code = quote! {
#item
impl #impl_generics crate::bytebuf::packet::Packet for #name #ty_generics {
const PACKET_ID: i32 = #input;
}
};
gen.into()
code.into()
}
#[proc_macro_attribute]
@ -180,14 +181,14 @@ pub fn server_packet(input: TokenStream, item: TokenStream) -> TokenStream {
let input: proc_macro2::TokenStream = input.into();
let item: proc_macro2::TokenStream = item.into();
let gen = quote! {
let code = quote! {
#item
impl #impl_generics crate::bytebuf::packet::Packet for #name #ty_generics {
const PACKET_ID: i32 = #input;
}
};
gen.into()
code.into()
}
#[proc_macro_attribute]
@ -205,7 +206,7 @@ pub fn pumpkin_block(input: TokenStream, item: TokenStream) -> TokenStream {
let item: proc_macro2::TokenStream = item.into();
let gen = quote! {
let code = quote! {
#item
impl #impl_generics crate::block::pumpkin_block::BlockMetadata for #name #ty_generics {
const NAMESPACE: &'static str = #namespace;
@ -213,7 +214,7 @@ pub fn pumpkin_block(input: TokenStream, item: TokenStream) -> TokenStream {
}
};
gen.into()
code.into()
}
#[proc_macro_attribute]
@ -229,14 +230,14 @@ pub fn pumpkin_item(input: TokenStream, item: TokenStream) -> TokenStream {
let item: proc_macro2::TokenStream = item.into();
let gen = quote! {
let code = quote! {
#item
impl #impl_generics crate::item::pumpkin_item::ItemMetadata for #name #ty_generics {
const ID: u16 = #id;
}
};
gen.into()
code.into()
}
#[proc_macro_attribute]
@ -351,7 +352,7 @@ pub fn block_property(input: TokenStream, item: TokenStream) -> TokenStream {
}
};
let gen = quote! {
let code = quote! {
#item
impl #impl_generics crate::block::properties::BlockPropertyMetadata for #name #ty_generics {
fn name(&self) -> &'static str {
@ -372,7 +373,7 @@ pub fn block_property(input: TokenStream, item: TokenStream) -> TokenStream {
#extra
};
gen.into()
code.into()
}
mod block_state;

View File

@ -1,7 +1,7 @@
use crate::deserializer::ReadAdaptor;
use crate::serializer::WriteAdaptor;
use crate::tag::NbtTag;
use crate::{get_nbt_string, Error, Nbt, END_ID};
use crate::{END_ID, Error, Nbt, get_nbt_string};
use std::io::{ErrorKind, Read, Write};
use std::vec::IntoIter;

View File

@ -1,7 +1,7 @@
use crate::*;
use io::Read;
use serde::de::{self, DeserializeSeed, IntoDeserializer, MapAccess, SeqAccess, Visitor};
use serde::{forward_to_deserialize_any, Deserialize};
use serde::{Deserialize, forward_to_deserialize_any};
pub type Result<T> = std::result::Result<T, Error>;

View File

@ -210,13 +210,13 @@ impl_array!(nbt_byte_array, NBT_BYTE_ARRAY_TAG);
#[cfg(test)]
mod test {
use crate::Error;
use crate::deserializer::from_bytes;
use crate::nbt_byte_array;
use crate::nbt_int_array;
use crate::nbt_long_array;
use crate::serializer::to_bytes;
use crate::serializer::to_bytes_named;
use crate::Error;
use crate::{deserializer::from_bytes_unnamed, serializer::to_bytes_unnamed};
use serde::{Deserialize, Serialize};

View File

@ -1,10 +1,10 @@
use serde::ser::Impossible;
use serde::{ser, Serialize};
use serde::{Serialize, ser};
use std::io::Write;
use crate::tag::NbtTag;
use crate::{
Error, BYTE_ARRAY_ID, BYTE_ID, COMPOUND_ID, DOUBLE_ID, END_ID, FLOAT_ID, INT_ARRAY_ID, INT_ID,
BYTE_ARRAY_ID, BYTE_ID, COMPOUND_ID, DOUBLE_ID, END_ID, Error, FLOAT_ID, INT_ARRAY_ID, INT_ID,
LIST_ID, LONG_ARRAY_ID, LONG_ID, NBT_ARRAY_TAG, NBT_BYTE_ARRAY_TAG, NBT_INT_ARRAY_TAG,
NBT_LONG_ARRAY_TAG, SHORT_ID, STRING_ID,
};
@ -393,7 +393,7 @@ impl<W: Write> ser::Serializer for &mut Serializer<W> {
_ => {
return Err(Error::SerdeError(
"Array supports only byte, int, long".to_string(),
))
));
}
};

View File

@ -1,11 +1,11 @@
use core::str;
use crate::{
codec::{
bit_set::BitSet, identifier::Identifier, var_int::VarInt, var_long::VarLong, Codec,
DecodeError,
},
FixedBitSet,
codec::{
Codec, DecodeError, bit_set::BitSet, identifier::Identifier, var_int::VarInt,
var_long::VarLong,
},
};
use bytes::{Buf, BufMut};
@ -279,8 +279,8 @@ mod test {
use serde::{Deserialize, Serialize};
use crate::{
bytebuf::{deserializer, serializer},
VarInt,
bytebuf::{deserializer, serializer},
};
#[test]

View File

@ -1,9 +1,9 @@
use bytes::{Buf, BufMut};
use serde::{de::DeserializeOwned, Serialize};
use serde::{Serialize, de::DeserializeOwned};
use crate::{codec::var_int::VarIntType, ClientPacket, ServerPacket};
use crate::{ClientPacket, ServerPacket, codec::var_int::VarIntType};
use super::{deserializer, serializer, ReadingError};
use super::{ReadingError, deserializer, serializer};
pub trait Packet {
const PACKET_ID: VarIntType;

View File

@ -2,8 +2,8 @@ use std::fmt::Display;
use bytes::BufMut;
use serde::{
ser::{self},
Serialize,
ser::{self},
};
use thiserror::Error;

View File

@ -2,7 +2,7 @@ use bytes::BufMut;
use pumpkin_data::packet::clientbound::CONFIG_SELECT_KNOWN_PACKS;
use pumpkin_macros::client_packet;
use crate::{bytebuf::ByteBufMut, ClientPacket, KnownPack};
use crate::{ClientPacket, KnownPack, bytebuf::ByteBufMut};
#[client_packet(CONFIG_SELECT_KNOWN_PACKS)]
pub struct CKnownPacks<'a> {

View File

@ -3,7 +3,7 @@ use pumpkin_data::packet::clientbound::CONFIG_REGISTRY_DATA;
use pumpkin_macros::client_packet;
use serde::Serialize;
use crate::{bytebuf::ByteBufMut, codec::identifier::Identifier, ClientPacket};
use crate::{ClientPacket, bytebuf::ByteBufMut, codec::identifier::Identifier};
#[client_packet(CONFIG_REGISTRY_DATA)]
pub struct CRegistryData<'a> {

View File

@ -1,4 +1,4 @@
use crate::{codec::identifier::Identifier, VarInt};
use crate::{VarInt, codec::identifier::Identifier};
use pumpkin_data::packet::clientbound::CONFIG_STORE_COOKIE;
use pumpkin_macros::client_packet;

View File

@ -8,9 +8,9 @@ use pumpkin_macros::client_packet;
use pumpkin_world::block::registry;
use crate::{
ClientPacket,
bytebuf::ByteBufMut,
codec::{identifier::Identifier, var_int::VarInt},
ClientPacket,
};
#[client_packet(CONFIG_UPDATE_TAGS)]

View File

@ -2,7 +2,7 @@ use bytes::BufMut;
use pumpkin_data::packet::clientbound::LOGIN_LOGIN_FINISHED;
use pumpkin_macros::client_packet;
use crate::{bytebuf::ByteBufMut, ClientPacket, Property};
use crate::{ClientPacket, Property, bytebuf::ByteBufMut};
#[client_packet(LOGIN_LOGIN_FINISHED)]
pub struct CLoginSuccess<'a> {

View File

@ -1,11 +1,11 @@
use crate::{bytebuf::ByteBufMut, codec::bit_set::BitSet, ClientPacket, VarInt};
use crate::{ClientPacket, VarInt, bytebuf::ByteBufMut, codec::bit_set::BitSet};
use bytes::{BufMut, BytesMut};
use pumpkin_data::packet::clientbound::PLAY_LEVEL_CHUNK_WITH_LIGHT;
use pumpkin_macros::client_packet;
use pumpkin_world::{
chunk::{ChunkData, SUBCHUNKS_COUNT},
DIRECT_PALETTE_BITS,
chunk::{ChunkData, SUBCHUNKS_COUNT},
};
#[client_packet(PLAY_LEVEL_CHUNK_WITH_LIGHT)]
@ -73,7 +73,7 @@ impl ClientPacket for CChunkData<'_> {
.iter()
.position(|b| b == block)
.expect("Its just got added, ofc it should be there");
out_long = out_long << block_size | (index as i64);
out_long = (out_long << block_size) | (index as i64);
}
data_buf.put_i64(out_long);
}

View File

@ -3,7 +3,7 @@ use pumpkin_data::packet::clientbound::PLAY_COMMAND_SUGGESTIONS;
use pumpkin_macros::client_packet;
use pumpkin_util::text::TextComponent;
use crate::{bytebuf::ByteBufMut, ClientPacket, VarInt};
use crate::{ClientPacket, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_COMMAND_SUGGESTIONS)]
pub struct CCommandSuggestions {

View File

@ -2,7 +2,7 @@ use bytes::BufMut;
use pumpkin_data::packet::clientbound::PLAY_COMMANDS;
use pumpkin_macros::client_packet;
use crate::{bytebuf::ByteBufMut, ClientPacket, VarInt};
use crate::{ClientPacket, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_COMMANDS)]
pub struct CCommands<'a> {
@ -114,12 +114,19 @@ impl ProtoNode<'_> {
if flags & Self::FLAG_HAS_SUGGESTION_TYPE != 0 {
match &self.node_type {
ProtoNodeType::Argument { name: _, is_executable: _, parser: _, override_suggestion_type } => {
ProtoNodeType::Argument {
name: _,
is_executable: _,
parser: _,
override_suggestion_type,
} => {
// suggestion type
let suggestion_type = &override_suggestion_type.expect("ProtoNode::FLAG_HAS_SUGGESTION_TYPE should only be set if override_suggestion_type is not None.");
bytebuf.put_string(suggestion_type.identifier());
},
_ => unimplemented!("ProtoNode::FLAG_HAS_SUGGESTION_TYPE is only implemented for ProtoNodeType::Argument"),
}
_ => unimplemented!(
"ProtoNode::FLAG_HAS_SUGGESTION_TYPE is only implemented for ProtoNodeType::Argument"
),
}
}
}

View File

@ -2,7 +2,7 @@ use bytes::BufMut;
use pumpkin_data::{packet::clientbound::PLAY_SOUND_ENTITY, sound::SoundCategory};
use pumpkin_macros::client_packet;
use crate::{bytebuf::ByteBufMut, ClientPacket, IDOrSoundEvent, SoundEvent, VarInt};
use crate::{ClientPacket, IDOrSoundEvent, SoundEvent, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_SOUND_ENTITY)]
pub struct CEntitySoundEffect {

View File

@ -2,7 +2,7 @@ use pumpkin_data::packet::clientbound::PLAY_INITIALIZE_BORDER;
use pumpkin_macros::client_packet;
use serde::Serialize;
use crate::{codec::var_long::VarLong, VarInt};
use crate::{VarInt, codec::var_long::VarLong};
#[derive(Serialize)]
#[client_packet(PLAY_INITIALIZE_BORDER)]

View File

@ -4,7 +4,7 @@ use pumpkin_util::math::position::BlockPos;
use pumpkin_macros::client_packet;
use serde::Serialize;
use crate::{codec::identifier::Identifier, VarInt};
use crate::{VarInt, codec::identifier::Identifier};
#[derive(Serialize)]
#[client_packet(PLAY_LOGIN)]

View File

@ -4,7 +4,7 @@ use pumpkin_util::text::TextComponent;
use pumpkin_macros::client_packet;
use serde::Serialize;
use crate::{codec::bit_set::BitSet, VarInt};
use crate::{VarInt, codec::bit_set::BitSet};
#[derive(Serialize)]
#[client_packet(PLAY_PLAYER_CHAT)]

View File

@ -2,7 +2,7 @@ use bytes::BufMut;
use pumpkin_data::packet::clientbound::PLAY_PLAYER_INFO_UPDATE;
use pumpkin_macros::client_packet;
use crate::{bytebuf::ByteBufMut, ClientPacket, Property};
use crate::{ClientPacket, Property, bytebuf::ByteBufMut};
use super::PlayerAction;

View File

@ -3,7 +3,7 @@ use pumpkin_data::packet::clientbound::PLAY_PLAYER_POSITION;
use pumpkin_macros::client_packet;
use pumpkin_util::math::vector3::Vector3;
use crate::{bytebuf::ByteBufMut, ClientPacket, PositionFlag, VarInt};
use crate::{ClientPacket, PositionFlag, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_PLAYER_POSITION)]
pub struct CPlayerPosition<'a> {

View File

@ -1,6 +1,6 @@
use pumpkin_data::packet::clientbound::PLAY_PLAYER_INFO_REMOVE;
use pumpkin_macros::client_packet;
use serde::{ser::SerializeSeq, Serialize};
use serde::{Serialize, ser::SerializeSeq};
use crate::VarInt;

View File

@ -3,7 +3,7 @@ use pumpkin_macros::client_packet;
use pumpkin_util::math::position::BlockPos;
use serde::Serialize;
use crate::{codec::identifier::Identifier, VarInt};
use crate::{VarInt, codec::identifier::Identifier};
#[derive(Serialize)]
#[client_packet(PLAY_RESPAWN)]

View File

@ -1,5 +1,5 @@
use crate::codec::slot::Slot;
use crate::VarInt;
use crate::codec::slot::Slot;
use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_CONTENT;
use pumpkin_macros::client_packet;

View File

@ -1,5 +1,5 @@
use crate::codec::slot::Slot;
use crate::VarInt;
use crate::codec::slot::Slot;
use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_SLOT;
use pumpkin_macros::client_packet;

View File

@ -1,12 +1,12 @@
use crate::bytebuf::{serializer::Serializer, ByteBufMut};
use crate::bytebuf::{ByteBufMut, serializer::Serializer};
use bytes::BytesMut;
use pumpkin_data::packet::clientbound::PLAY_SET_EQUIPMENT;
use pumpkin_macros::client_packet;
use serde::Serialize;
use crate::{
codec::{slot::Slot, var_int::VarInt},
ClientPacket,
codec::{slot::Slot, var_int::VarInt},
};
#[client_packet(PLAY_SET_EQUIPMENT)]

View File

@ -3,7 +3,7 @@ use pumpkin_data::{packet::clientbound::PLAY_SOUND, sound::SoundCategory};
use pumpkin_macros::client_packet;
use pumpkin_util::math::vector3::Vector3;
use crate::{bytebuf::ByteBufMut, ClientPacket, IDOrSoundEvent, SoundEvent, VarInt};
use crate::{ClientPacket, IDOrSoundEvent, SoundEvent, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_SOUND)]
pub struct CSoundEffect {

View File

@ -1,4 +1,4 @@
use crate::{codec::identifier::Identifier, VarInt};
use crate::{VarInt, codec::identifier::Identifier};
use pumpkin_data::packet::clientbound::PLAY_STORE_COOKIE;
use pumpkin_macros::client_packet;
use serde::Serialize;

View File

@ -3,7 +3,7 @@ use pumpkin_data::packet::clientbound::PLAY_TELEPORT_ENTITY;
use pumpkin_macros::client_packet;
use pumpkin_util::math::vector3::Vector3;
use crate::{bytebuf::ByteBufMut, ClientPacket, PositionFlag, VarInt};
use crate::{ClientPacket, PositionFlag, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_TELEPORT_ENTITY)]
pub struct CTeleportEntity<'a> {

View File

@ -3,7 +3,7 @@ use pumpkin_data::packet::clientbound::PLAY_SET_OBJECTIVE;
use pumpkin_macros::client_packet;
use pumpkin_util::text::TextComponent;
use crate::{bytebuf::ByteBufMut, ClientPacket, NumberFormat, VarInt};
use crate::{ClientPacket, NumberFormat, VarInt, bytebuf::ByteBufMut};
#[client_packet(PLAY_SET_OBJECTIVE)]
pub struct CUpdateObjectives<'a> {

View File

@ -6,7 +6,7 @@ use serde::{Serialize, Serializer};
use crate::bytebuf::ByteBuf;
use crate::bytebuf::ByteBufMut;
use super::{var_int::VarInt, Codec, DecodeError};
use super::{Codec, DecodeError, var_int::VarInt};
pub struct BitSet(pub VarInt, pub Vec<i64>);

View File

@ -1,7 +1,7 @@
use std::num::NonZeroUsize;
use bytes::{Buf, BufMut};
use serde::{de::Visitor, Deserialize, Deserializer, Serialize, Serializer};
use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Visitor};
use crate::bytebuf::{ByteBuf, ByteBufMut};

View File

@ -3,8 +3,8 @@ use pumpkin_data::item::Item;
use pumpkin_world::item::ItemStack;
use serde::ser::SerializeSeq;
use serde::{
de::{self, SeqAccess},
Deserialize, Serialize, Serializer,
de::{self, SeqAccess},
};
#[derive(Debug, Clone)]

View File

@ -3,8 +3,8 @@ use std::{num::NonZeroUsize, ops::Deref};
use super::{Codec, DecodeError};
use bytes::{Buf, BufMut};
use serde::{
de::{SeqAccess, Visitor},
Deserialize, Deserializer, Serialize, Serializer,
de::{SeqAccess, Visitor},
};
pub type VarIntType = i32;

View File

@ -3,8 +3,8 @@ use std::{num::NonZeroUsize, ops::Deref};
use super::{Codec, DecodeError};
use bytes::{Buf, BufMut};
use serde::{
de::{self, SeqAccess, Visitor},
Deserialize, Deserializer, Serialize, Serializer,
de::{self, SeqAccess, Visitor},
};
pub type VarLongType = i64;

View File

@ -1,9 +1,9 @@
use std::num::NonZeroU16;
use bytebuf::{packet::Packet, ReadingError};
use bytebuf::{ReadingError, packet::Packet};
use bytes::{Buf, BufMut, Bytes};
use codec::{identifier::Identifier, var_int::VarInt};
use pumpkin_util::text::{style::Style, TextComponent};
use pumpkin_util::text::{TextComponent, style::Style};
use serde::{Deserialize, Serialize, Serializer};
pub mod bytebuf;

View File

@ -1,11 +1,11 @@
use aes::cipher::{generic_array::GenericArray, BlockDecryptMut, BlockSizeUser, KeyIvInit};
use aes::cipher::{BlockDecryptMut, BlockSizeUser, KeyIvInit, generic_array::GenericArray};
use bytes::{Buf, Bytes, BytesMut};
use libdeflater::{DecompressionError, Decompressor};
use thiserror::Error;
use crate::{
MAX_PACKET_SIZE, RawPacket, VarInt,
codec::{Codec, DecodeError},
RawPacket, VarInt, MAX_PACKET_SIZE,
};
type Cipher = cfb8::Decryptor<aes::Aes128>;
@ -193,8 +193,8 @@ mod tests {
use super::*;
use aes::Aes128;
use bytes::BufMut;
use cfb8::cipher::AsyncStreamCipher;
use cfb8::Encryptor as Cfb8Encryptor;
use cfb8::cipher::AsyncStreamCipher;
use libdeflater::{CompressionLvl, Compressor};
/// Helper function to compress data using libdeflater's Zlib compressor

View File

@ -1,11 +1,11 @@
use aes::cipher::{generic_array::GenericArray, BlockEncryptMut, BlockSizeUser, KeyIvInit};
use aes::cipher::{BlockEncryptMut, BlockSizeUser, KeyIvInit, generic_array::GenericArray};
use bytes::{BufMut, BytesMut};
use thiserror::Error;
use libdeflater::{CompressionLvl, Compressor};
use crate::{
codec::Codec, ClientPacket, CompressionLevel, CompressionThreshold, VarInt, MAX_PACKET_SIZE,
ClientPacket, CompressionLevel, CompressionThreshold, MAX_PACKET_SIZE, VarInt, codec::Codec,
};
type Cipher = cfb8::Encryptor<aes::Aes128>;
@ -218,8 +218,8 @@ mod tests {
use crate::client::status::CStatusResponse;
use crate::{bytebuf::packet::Packet, codec::DecodeError};
use aes::Aes128;
use cfb8::cipher::AsyncStreamCipher;
use cfb8::Decryptor as Cfb8Decryptor;
use cfb8::cipher::AsyncStreamCipher;
use libdeflater::{DecompressionError, Decompressor};
use pumpkin_data::packet::clientbound::STATUS_STATUS_RESPONSE;
use pumpkin_macros::client_packet;

View File

@ -3,9 +3,9 @@ use pumpkin_data::packet::serverbound::CONFIG_COOKIE_RESPONSE;
use pumpkin_macros::server_packet;
use crate::{
ServerPacket, VarInt,
bytebuf::{ByteBuf, ReadingError},
codec::identifier::Identifier,
ServerPacket, VarInt,
};
#[server_packet(CONFIG_COOKIE_RESPONSE)]

View File

@ -3,9 +3,9 @@ use pumpkin_data::packet::serverbound::CONFIG_CUSTOM_PAYLOAD;
use pumpkin_macros::server_packet;
use crate::{
ServerPacket,
bytebuf::{ByteBuf, ReadingError},
codec::identifier::Identifier,
ServerPacket,
};
const MAX_PAYLOAD_SIZE: usize = 1048576;

View File

@ -3,8 +3,8 @@ use pumpkin_data::packet::serverbound::HANDSHAKE_INTENTION;
use pumpkin_macros::server_packet;
use crate::{
bytebuf::{ByteBuf, ReadingError},
ConnectionState, ServerPacket, VarInt,
bytebuf::{ByteBuf, ReadingError},
};
#[server_packet(HANDSHAKE_INTENTION)]

View File

@ -1,7 +1,7 @@
use crate::{
ServerPacket, VarInt,
bytebuf::{ByteBuf, ReadingError},
codec::identifier::Identifier,
ServerPacket, VarInt,
};
use bytes::Buf;
use pumpkin_data::packet::serverbound::LOGIN_COOKIE_RESPONSE;

View File

@ -3,8 +3,8 @@ use pumpkin_data::packet::serverbound::LOGIN_KEY;
use pumpkin_macros::server_packet;
use crate::{
bytebuf::{ByteBuf, ReadingError},
ServerPacket, VarInt,
bytebuf::{ByteBuf, ReadingError},
};
#[server_packet(LOGIN_KEY)]

View File

@ -3,8 +3,8 @@ use pumpkin_data::packet::serverbound::LOGIN_HELLO;
use pumpkin_macros::server_packet;
use crate::{
bytebuf::{ByteBuf, ReadingError},
ServerPacket,
bytebuf::{ByteBuf, ReadingError},
};
#[server_packet(LOGIN_HELLO)]

View File

@ -1,6 +1,6 @@
use crate::{
bytebuf::{ByteBuf, ReadingError},
ServerPacket, VarInt,
bytebuf::{ByteBuf, ReadingError},
};
use bytes::{Buf, Bytes};
use pumpkin_data::packet::serverbound::LOGIN_CUSTOM_QUERY_ANSWER;

View File

@ -3,8 +3,8 @@ use pumpkin_data::packet::serverbound::PLAY_CHAT;
use pumpkin_macros::server_packet;
use crate::{
bytebuf::{ByteBuf, ReadingError},
FixedBitSet, ServerPacket, VarInt,
bytebuf::{ByteBuf, ReadingError},
};
// derive(Deserialize)]

View File

@ -1,9 +1,9 @@
use crate::codec::slot::Slot;
use crate::VarInt;
use crate::codec::slot::Slot;
use pumpkin_data::packet::serverbound::PLAY_CONTAINER_CLICK;
use pumpkin_macros::server_packet;
use serde::de::SeqAccess;
use serde::{de, Deserialize};
use serde::{Deserialize, de};
#[server_packet(PLAY_CONTAINER_CLICK)]
pub struct SClickContainer {

View File

@ -1,7 +1,7 @@
use crate::{
ServerPacket, VarInt,
bytebuf::{ByteBuf, ReadingError},
codec::identifier::Identifier,
ServerPacket, VarInt,
};
use bytes::Buf;
use pumpkin_data::packet::serverbound::PLAY_COOKIE_RESPONSE;

View File

@ -4,8 +4,8 @@ use pumpkin_macros::server_packet;
use pumpkin_util::math::vector3::Vector3;
use crate::{
bytebuf::{ByteBuf, ReadingError},
ServerPacket, VarInt,
bytebuf::{ByteBuf, ReadingError},
};
#[server_packet(PLAY_INTERACT)]

View File

@ -3,8 +3,8 @@ use pumpkin_data::packet::serverbound::PLAY_PLAYER_COMMAND;
use pumpkin_macros::server_packet;
use crate::{
bytebuf::{ByteBuf, ReadingError},
ServerPacket, VarInt,
bytebuf::{ByteBuf, ReadingError},
};
#[server_packet(PLAY_PLAYER_COMMAND)]

View File

@ -4,8 +4,8 @@ use pumpkin_macros::server_packet;
use pumpkin_util::math::position::BlockPos;
use crate::{
bytebuf::{ByteBuf, ReadingError},
ServerPacket,
bytebuf::{ByteBuf, ReadingError},
};
#[server_packet(PLAY_SIGN_UPDATE)]

View File

@ -11,7 +11,7 @@ use instrument::Instrument;
use jukebox_song::JukeboxSong;
use paint::Painting;
use pumpkin_protocol::{client::config::RegistryEntry, codec::identifier::Identifier};
pub use recipe::{flatten_3x3, Recipe, RecipeResult, RecipeType, RECIPES};
pub use recipe::{RECIPES, Recipe, RecipeResult, RecipeType, flatten_3x3};
use serde::{Deserialize, Serialize};
use trim_material::TrimMaterial;
use trim_pattern::TrimPattern;

View File

@ -1,13 +1,13 @@
use crate::flatten_3x3;
use crate::recipe::read::ingredients::Ingredients;
use crate::recipe::read::SpecialCraftingType::{
ArmorDye, BannerDuplicate, BookCloning, Firework, RepairItem, ShieldDecoration,
ShulkerboxColoring, SuspiciousStew, TippedArrow,
};
use crate::recipe::read::ingredients::Ingredients;
use crate::recipe::recipe_formats::{ShapedCrafting, ShapelessCrafting};
use pumpkin_data::tag::RegistryEntryList;
use serde::de::{Error, MapAccess, Visitor};
use serde::{de, Deserialize, Deserializer};
use serde::{Deserialize, Deserializer, de};
use std::collections::HashMap;
use std::fmt::Formatter;
use std::str::FromStr;

View File

@ -1,5 +1,5 @@
use super::{
gaussian::GaussianGenerator, hash_block_pos, java_string_hash, RandomDeriverImpl, RandomImpl,
RandomDeriverImpl, RandomImpl, gaussian::GaussianGenerator, hash_block_pos, java_string_hash,
};
pub struct LegacyRand {
@ -121,7 +121,7 @@ impl RandomDeriverImpl for LegacySplitter {
#[cfg(test)]
mod test {
use crate::random::{legacy_rand::LegacySplitter, RandomDeriverImpl, RandomImpl};
use crate::random::{RandomDeriverImpl, RandomImpl, legacy_rand::LegacySplitter};
use super::LegacyRand;

View File

@ -1,4 +1,4 @@
use super::{gaussian::GaussianGenerator, hash_block_pos, RandomDeriverImpl, RandomImpl};
use super::{RandomDeriverImpl, RandomImpl, gaussian::GaussianGenerator, hash_block_pos};
pub struct Xoroshiro {
lo: u64,
@ -154,7 +154,7 @@ impl RandomDeriverImpl for XoroshiroSplitter {
mod tests {
use crate::random::{RandomDeriverImpl, RandomImpl};
use super::{mix_stafford_13, Xoroshiro};
use super::{Xoroshiro, mix_stafford_13};
// Values checked against results from the equivalent Java source

View File

@ -266,7 +266,7 @@ pub enum TextContent {
mod test {
use pumpkin_nbt::serializer::to_bytes_unnamed;
use crate::text::{color::NamedColor, TextComponent};
use crate::text::{TextComponent, color::NamedColor};
#[test]
fn test_serialize_text_component() {

View File

@ -1,6 +1,6 @@
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{Criterion, criterion_group, criterion_main};
use pumpkin_world::{
bench_create_and_populate_noise, GlobalProtoNoiseRouter, GlobalRandomConfig, NOISE_ROUTER_ASTS,
GlobalProtoNoiseRouter, GlobalRandomConfig, NOISE_ROUTER_ASTS, bench_create_and_populate_noise,
};
fn criterion_benchmark(c: &mut Criterion) {

View File

@ -505,9 +505,9 @@ mod tests {
use temp_dir::TempDir;
use crate::chunk::ChunkWriter;
use crate::generation::{get_world_gen, Seed};
use crate::generation::{Seed, get_world_gen};
use crate::{
chunk::{anvil::AnvilChunkFormat, ChunkReader, ChunkReadingError},
chunk::{ChunkReader, ChunkReadingError, anvil::AnvilChunkFormat},
level::LevelFolder,
};

View File

@ -464,9 +464,9 @@ mod tests {
use temp_dir::TempDir;
use crate::chunk::ChunkWriter;
use crate::generation::{get_world_gen, Seed};
use crate::generation::{Seed, get_world_gen};
use crate::{
chunk::{linear::LinearChunkFormat, ChunkReader, ChunkReadingError},
chunk::{ChunkReader, ChunkReadingError, linear::LinearChunkFormat},
level::LevelFolder,
};

View File

@ -1,6 +1,6 @@
use dashmap::{
mapref::one::{Ref, RefMut},
DashMap,
mapref::one::{Ref, RefMut},
};
use pumpkin_data::chunk::ChunkStatus;
use pumpkin_nbt::{deserializer::from_bytes, nbt_long_array};
@ -15,10 +15,10 @@ use std::{
use thiserror::Error;
use crate::{
WORLD_HEIGHT,
block::BlockState,
coordinates::{ChunkRelativeBlockCoordinates, Height},
level::LevelFolder,
WORLD_HEIGHT,
};
pub mod anvil;

View File

@ -14,7 +14,7 @@ use super::{
chunk_noise_router::ChunkNoiseRouter,
density_function::{NoisePos, UnblendedNoisePos},
},
positions::{block_pos, chunk_pos, MIN_HEIGHT_CELL},
positions::{MIN_HEIGHT_CELL, block_pos, chunk_pos},
proto_chunk::StandardChunkFluidLevelSampler,
section_coords,
};
@ -214,18 +214,10 @@ impl WorldAquiferSampler {
let o = halved_diff - scaled_level.abs();
let q = if scaled_level > 0f64 {
if o > 0f64 {
o / 1.5f64
} else {
o / 2.5f64
}
if o > 0f64 { o / 1.5f64 } else { o / 2.5f64 }
} else {
let p = 3f64 + o;
if p > 0f64 {
p / 3f64
} else {
p / 10f64
}
if p > 0f64 { p / 3f64 } else { p / 10f64 }
};
let r = if (-2f64..=2f64).contains(&q) {
@ -661,6 +653,7 @@ mod test {
use crate::{
block::BlockState,
generation::{
GlobalRandomConfig,
chunk_noise::{
BlockStateSampler, ChainedBlockStateSampler, ChunkNoiseGenerator,
ChunkNoiseHeightEstimator, LAVA_BLOCK, WATER_BLOCK,
@ -674,7 +667,6 @@ mod test {
},
positions::chunk_pos,
proto_chunk::StandardChunkFluidLevelSampler,
GlobalRandomConfig,
},
noise_router::NOISE_ROUTER_ASTS,
};

View File

@ -6,6 +6,7 @@ use pumpkin_util::math::{floor_div, floor_mod, vector2::Vector2};
use crate::{block::BlockState, generation::section_coords};
use super::{
GlobalRandomConfig,
aquifer_sampler::{
AquiferSampler, AquiferSamplerImpl, FluidLevelSampler, SeaLevelAquiferSampler,
WorldAquiferSampler,
@ -23,7 +24,6 @@ use super::{
},
ore_sampler::OreVeinSampler,
positions::chunk_pos,
GlobalRandomConfig,
};
pub const STONE_BLOCK: BlockState = block_state!("stone");

View File

@ -2,14 +2,14 @@ use noise::{NoiseFn, Perlin};
use pumpkin_util::math::vector2::Vector2;
use crate::{
WORLD_LOWEST_Y,
chunk::{ChunkData, Subchunks},
coordinates::{ChunkRelativeBlockCoordinates, ChunkRelativeXZBlockCoordinates},
WORLD_LOWEST_Y,
};
use super::{
generator::{BiomeGenerator, GeneratorInit, PerlinTerrainGenerator, WorldGenerator},
Seed,
generator::{BiomeGenerator, GeneratorInit, PerlinTerrainGenerator, WorldGenerator},
};
pub struct GenericGenerator<B: BiomeGenerator, T: PerlinTerrainGenerator> {

View File

@ -5,9 +5,9 @@ use crate::{
block::state::BlockState,
coordinates::XZBlockCoordinates,
generation::{
Seed,
generator::{BiomeGenerator, GeneratorInit, TerrainGenerator},
generic_generator::GenericGenerator,
Seed,
},
};

View File

@ -1,14 +1,14 @@
use pumpkin_util::math::{vector2::Vector2, vector3::Vector3};
use crate::{
WORLD_LOWEST_Y, WORLD_MAX_Y,
chunk::{ChunkData, Subchunks},
coordinates::ChunkRelativeBlockCoordinates,
generation::{
generator::GeneratorInit, noise_router::proto_noise_router::GlobalProtoNoiseRouter,
proto_chunk::ProtoChunk, GlobalRandomConfig, Seed, WorldGenerator,
GlobalRandomConfig, Seed, WorldGenerator, generator::GeneratorInit,
noise_router::proto_noise_router::GlobalProtoNoiseRouter, proto_chunk::ProtoChunk,
},
noise_router::NOISE_ROUTER_ASTS,
WORLD_LOWEST_Y, WORLD_MAX_Y,
};
pub struct TestGenerator {

View File

@ -21,7 +21,7 @@ use implementation::{
//overworld::biome::plains::PlainsGenerator,
test::TestGenerator,
};
use pumpkin_util::random::{xoroshiro128::Xoroshiro, RandomDeriver, RandomImpl};
use pumpkin_util::random::{RandomDeriver, RandomImpl, xoroshiro128::Xoroshiro};
pub use seed::Seed;
use generator::GeneratorInit;

View File

@ -2,7 +2,7 @@ use num_traits::Pow;
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
use pumpkin_util::random::RandomGenerator;
use super::{lerp3, GRADIENTS};
use super::{GRADIENTS, lerp3};
#[derive(Clone)]
pub struct PerlinNoiseSampler {
@ -357,7 +357,7 @@ mod double_perlin_noise_sampler_test {
use crate::generation::noise::perlin::DoublePerlinNoiseSampler;
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
use pumpkin_util::random::{
legacy_rand::LegacyRand, xoroshiro128::Xoroshiro, RandomGenerator, RandomImpl,
RandomGenerator, RandomImpl, legacy_rand::LegacyRand, xoroshiro128::Xoroshiro,
};
#[test]
@ -560,7 +560,7 @@ mod double_perlin_noise_sampler_test {
#[cfg(test)]
mod octave_perline_noise_sampler_test {
use pumpkin_util::random::{
legacy_rand::LegacyRand, xoroshiro128::Xoroshiro, RandomGenerator, RandomImpl,
RandomGenerator, RandomImpl, legacy_rand::LegacyRand, xoroshiro128::Xoroshiro,
};
use super::OctavePerlinNoiseSampler;
@ -733,7 +733,7 @@ mod perlin_noise_sampler_test {
use pumpkin_util::{
assert_eq_delta,
random::{xoroshiro128::Xoroshiro, RandomDeriverImpl, RandomGenerator, RandomImpl},
random::{RandomDeriverImpl, RandomGenerator, RandomImpl, xoroshiro128::Xoroshiro},
};
use crate::{generation::noise::perlin::PerlinNoiseSampler, read_data_from_file};
@ -1268,7 +1268,9 @@ mod perlin_noise_sampler_test {
assert_eq!(first, -15);
assert_eq!(
amplitudes,
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
[
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
]
);
}

View File

@ -1,7 +1,7 @@
use std::hash::Hash;
use num_traits::Pow;
use pumpkin_util::random::{legacy_rand::LegacyRand, RandomImpl};
use pumpkin_util::random::{RandomImpl, legacy_rand::LegacyRand};
use super::GRADIENTS;
@ -274,7 +274,7 @@ impl OctaveSimplexNoiseSampler {
#[cfg(test)]
mod octave_simplex_noise_sampler_test {
use pumpkin_util::random::{xoroshiro128::Xoroshiro, RandomImpl};
use pumpkin_util::random::{RandomImpl, xoroshiro128::Xoroshiro};
use crate::generation::noise::simplex::OctaveSimplexNoiseSampler;
@ -410,7 +410,7 @@ mod octave_simplex_noise_sampler_test {
#[cfg(test)]
mod simplex_noise_sampler_test {
use pumpkin_util::random::{xoroshiro128::Xoroshiro, RandomImpl};
use pumpkin_util::random::{RandomImpl, xoroshiro128::Xoroshiro};
use crate::generation::noise::simplex::SimplexNoiseSampler;

View File

@ -1,6 +1,6 @@
use std::sync::Arc;
use pumpkin_util::random::{legacy_rand::LegacyRand, RandomImpl};
use pumpkin_util::random::{RandomImpl, legacy_rand::LegacyRand};
use crate::{
generation::{

View File

@ -5,6 +5,7 @@ use std::fs;
use std::path::Path;
use std::sync::LazyLock;
use crate::generation::GlobalRandomConfig;
use crate::generation::noise_router::chunk_density_function::{
ChunkNoiseFunctionSampleOptions, SampleAction,
};
@ -12,9 +13,8 @@ use crate::generation::noise_router::chunk_noise_router::{
ChunkNoiseDensityFunction, ChunkNoiseFunctionComponent,
};
use crate::generation::noise_router::proto_noise_router::{
recursive_build_proto_stack, DoublePerlinNoiseBuilder, ProtoNoiseFunctionComponent,
DoublePerlinNoiseBuilder, ProtoNoiseFunctionComponent, recursive_build_proto_stack,
};
use crate::generation::GlobalRandomConfig;
use crate::noise_router::NOISE_ROUTER_ASTS;
use crate::read_data_from_file;
use crate::{

View File

@ -1,6 +1,6 @@
use crate::{
generation::biome_coords, noise_router::density_function_ast::WrapperType,
GlobalProtoNoiseRouter,
GlobalProtoNoiseRouter, generation::biome_coords,
noise_router::density_function_ast::WrapperType,
};
use super::{
@ -187,7 +187,9 @@ impl<'a> MultiNoiseSampler<'a> {
))
}
_ => {
panic!("These density functions should not be a part of the MultiNoiseSampler! We probably need to re-write code");
panic!(
"These density functions should not be a part of the MultiNoiseSampler! We probably need to re-write code"
);
}
}
}

View File

@ -7,24 +7,24 @@ use enum_dispatch::enum_dispatch;
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
use crate::{
GlobalRandomConfig,
generation::noise::perlin::DoublePerlinNoiseSampler,
noise_router::{
density_function_ast::{DensityFunctionRepr, SplineRepr},
noise_router_ast::NoiseRouterRepr,
},
GlobalRandomConfig,
};
use super::{
chunk_density_function::ChunkNoiseFunctionSampleOptions,
chunk_noise_router::{ChunkNoiseFunctionComponent, StaticChunkNoiseFunctionComponentImpl},
density_function::{
IndexToNoisePos, NoiseFunctionComponentRange, NoisePos, PassThrough,
StaticIndependentChunkNoiseFunctionComponentImpl, Wrapper,
math::{Binary, Clamp, Constant, Linear, Unary},
misc::{ClampedYGradient, EndIsland, RangeChoice, WeirdScaled},
noise::{InterpolatedNoiseSampler, Noise, ShiftA, ShiftB, ShiftedNoise},
spline::{Spline, SplineFunction, SplinePoint, SplineValue},
IndexToNoisePos, NoiseFunctionComponentRange, NoisePos, PassThrough,
StaticIndependentChunkNoiseFunctionComponentImpl, Wrapper,
},
};

View File

@ -4,7 +4,7 @@ pub mod block_pos {
use pumpkin_util::math::vector3::Vector3;
use super::{
BITS_X, BITS_Y, BITS_Z, BIT_SHIFT_X, BIT_SHIFT_Z, SIZE_BITS_X, SIZE_BITS_Y, SIZE_BITS_Z,
BIT_SHIFT_X, BIT_SHIFT_Z, BITS_X, BITS_Y, BITS_Z, SIZE_BITS_X, SIZE_BITS_Y, SIZE_BITS_Z,
};
#[inline]

View File

@ -8,11 +8,11 @@ use crate::{
};
use super::{
GlobalRandomConfig,
aquifer_sampler::{FluidLevel, FluidLevelSampler, FluidLevelSamplerImpl},
chunk_noise::{ChunkNoiseGenerator, LAVA_BLOCK, STONE_BLOCK, WATER_BLOCK},
noise_router::proto_noise_router::GlobalProtoNoiseRouter,
positions::chunk_pos::{start_block_x, start_block_z},
GlobalRandomConfig,
};
pub struct StandardChunkFluidLevelSampler {
@ -239,13 +239,13 @@ mod test {
use crate::{
generation::{
GlobalRandomConfig,
noise_router::{
density_function::{NoiseFunctionComponentRange, PassThrough},
proto_noise_router::{GlobalProtoNoiseRouter, ProtoNoiseFunctionComponent},
},
GlobalRandomConfig,
},
noise_router::{density_function_ast::WrapperType, NOISE_ROUTER_ASTS},
noise_router::{NOISE_ROUTER_ASTS, density_function_ast::WrapperType},
read_data_from_file,
};

View File

@ -1,4 +1,4 @@
use pumpkin_util::random::{get_seed, java_string_hash, legacy_rand::LegacyRand, RandomImpl};
use pumpkin_util::random::{RandomImpl, get_seed, java_string_hash, legacy_rand::LegacyRand};
#[derive(Clone, Copy)]
pub struct Seed(pub u64);

View File

@ -2,24 +2,24 @@ use std::{fs, path::PathBuf, sync::Arc};
use dashmap::{DashMap, Entry};
use num_traits::Zero;
use pumpkin_config::{chunk::ChunkFormat, ADVANCED_CONFIG};
use pumpkin_config::{ADVANCED_CONFIG, chunk::ChunkFormat};
use pumpkin_util::math::vector2::Vector2;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use tokio::{
runtime::Handle,
sync::{mpsc, RwLock},
sync::{RwLock, mpsc},
};
use crate::{
chunk::{
anvil::AnvilChunkFormat, linear::LinearChunkFormat, ChunkData, ChunkParsingError,
ChunkReader, ChunkReadingError, ChunkWriter,
ChunkData, ChunkParsingError, ChunkReader, ChunkReadingError, ChunkWriter,
anvil::AnvilChunkFormat, linear::LinearChunkFormat,
},
generation::{get_world_gen, Seed, WorldGenerator},
lock::{anvil::AnvilLevelLocker, LevelLocker},
generation::{Seed, WorldGenerator, get_world_gen},
lock::{LevelLocker, anvil::AnvilLevelLocker},
world_info::{
anvil::{AnvilLevelInfo, LEVEL_DAT_BACKUP_FILE_NAME, LEVEL_DAT_FILE_NAME},
LevelData, WorldInfoError, WorldInfoReader, WorldInfoWriter,
anvil::{AnvilLevelInfo, LEVEL_DAT_BACKUP_FILE_NAME, LEVEL_DAT_FILE_NAME},
},
};

View File

@ -45,7 +45,7 @@ macro_rules! read_data_from_file {
// TODO: is there a way to do in-file benches?
pub use generation::{
noise_router::proto_noise_router::GlobalProtoNoiseRouter, GlobalRandomConfig,
GlobalRandomConfig, noise_router::proto_noise_router::GlobalProtoNoiseRouter,
};
pub use noise_router::NOISE_ROUTER_ASTS;

View File

@ -4,7 +4,7 @@ use std::{
time::{SystemTime, UNIX_EPOCH},
};
use flate2::{read::GzDecoder, write::GzEncoder, Compression};
use flate2::{Compression, read::GzDecoder, write::GzEncoder};
use serde::{Deserialize, Serialize};
use crate::{
@ -125,7 +125,7 @@ mod test {
world_info::{DataPacks, LevelData, WorldGenSettings, WorldInfoError, WorldVersion},
};
use super::{AnvilLevelInfo, LevelDat, WorldInfoReader, WorldInfoWriter, LEVEL_DAT_FILE_NAME};
use super::{AnvilLevelInfo, LEVEL_DAT_FILE_NAME, LevelDat, WorldInfoReader, WorldInfoWriter};
#[test]
fn test_preserve_level_dat_seed() {

View File

@ -2,8 +2,8 @@
name = "pumpkin"
version = "0.1.0-dev"
description = "Empowering everyone to host fast and efficient Minecraft servers."
edition = "2021"
rust-version = "1.83"
edition.workspace = true
rust-version = "1.85"
[package.metadata.tauri-winres]
# FileDescription is handled as the Program name by Windows!

View File

@ -8,7 +8,7 @@ use pumpkin_inventory::{Chest, OpenContainer};
use pumpkin_macros::pumpkin_block;
use pumpkin_protocol::{client::play::CBlockAction, codec::var_int::VarInt};
use pumpkin_util::math::position::BlockPos;
use pumpkin_world::block::registry::{get_block, Block};
use pumpkin_world::block::registry::{Block, get_block};
use crate::{
block::{pumpkin_block::PumpkinBlock, registry::BlockActionResult},

View File

@ -4,7 +4,7 @@ use pumpkin_data::item::Item;
use pumpkin_macros::pumpkin_block;
use pumpkin_protocol::server::play::SUseItemOn;
use pumpkin_util::math::position::BlockPos;
use pumpkin_world::block::{registry::Block, BlockDirection};
use pumpkin_world::block::{BlockDirection, registry::Block};
use crate::{
block::{properties::Direction, pumpkin_block::PumpkinBlock, registry::BlockActionResult},

View File

@ -1,5 +1,6 @@
use blocks::{chest::ChestBlock, furnace::FurnaceBlock, lever::LeverBlock};
use properties::{
BlockPropertiesManager,
age::Age,
attachment::Attachment,
axis::Axis,
@ -14,7 +15,6 @@ use properties::{
slab_type::SlabType,
stair_shape::StairShape,
waterlog::Waterlogged,
BlockPropertiesManager,
};
use pumpkin_data::entity::EntityType;
use pumpkin_data::item::Item;

View File

@ -3,7 +3,7 @@ use async_trait::async_trait;
use pumpkin_macros::block_property;
use pumpkin_protocol::server::play::SUseItemOn;
use pumpkin_util::math::position::BlockPos;
use pumpkin_world::block::{registry::Block, BlockDirection};
use pumpkin_world::block::{BlockDirection, registry::Block};
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};

View File

@ -3,7 +3,7 @@ use async_trait::async_trait;
use pumpkin_macros::block_property;
use pumpkin_protocol::server::play::SUseItemOn;
use pumpkin_util::math::position::BlockPos;
use pumpkin_world::block::{registry::Block, BlockDirection};
use pumpkin_world::block::{BlockDirection, registry::Block};
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};

View File

@ -3,7 +3,7 @@ use async_trait::async_trait;
use pumpkin_macros::block_property;
use pumpkin_protocol::server::play::SUseItemOn;
use pumpkin_util::math::{position::BlockPos, vector3::Vector3};
use pumpkin_world::block::{registry::Block, BlockDirection};
use pumpkin_world::block::{BlockDirection, registry::Block};
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};

View File

@ -3,7 +3,7 @@ use async_trait::async_trait;
use pumpkin_macros::block_property;
use pumpkin_protocol::server::play::SUseItemOn;
use pumpkin_util::math::position::BlockPos;
use pumpkin_world::block::{registry::Block, BlockDirection};
use pumpkin_world::block::{BlockDirection, registry::Block};
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};

View File

@ -3,7 +3,7 @@ use async_trait::async_trait;
use pumpkin_macros::block_property;
use pumpkin_protocol::server::play::SUseItemOn;
use pumpkin_util::math::position::BlockPos;
use pumpkin_world::block::{registry::Block, BlockDirection};
use pumpkin_world::block::{BlockDirection, registry::Block};
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};

View File

@ -3,7 +3,7 @@ use async_trait::async_trait;
use pumpkin_macros::block_property;
use pumpkin_protocol::server::play::SUseItemOn;
use pumpkin_util::math::position::BlockPos;
use pumpkin_world::block::{registry::Block, BlockDirection};
use pumpkin_world::block::{BlockDirection, registry::Block};
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};

View File

@ -4,8 +4,8 @@ use pumpkin_macros::block_property;
use pumpkin_protocol::server::play::SUseItemOn;
use pumpkin_util::math::position::BlockPos;
use pumpkin_world::block::{
registry::{Block, State},
BlockDirection,
registry::{Block, State},
};
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};

View File

@ -5,8 +5,8 @@ use pumpkin_protocol::server::play::SUseItemOn;
use pumpkin_util::math::position::BlockPos;
use pumpkin_world::{
block::{
registry::{Block, State, BLOCKS},
BlockDirection,
registry::{BLOCKS, Block, State},
},
item::ItemStack,
};

Some files were not shown because too many files have changed in this diff Show More