Update to Rust edition 2024
This commit is contained in:
parent
b428fdca1a
commit
1fb2be46d4
@ -14,7 +14,7 @@ members = [
|
|||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
name = "pumpkin-fuzz"
|
name = "pumpkin-fuzz"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
publish = false
|
publish = false
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[package.metadata]
|
[package.metadata]
|
||||||
cargo-fuzz = true
|
cargo-fuzz = true
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use proc_macro::TokenStream;
|
|||||||
use quote::quote;
|
use quote::quote;
|
||||||
use std::sync::LazyLock;
|
use std::sync::LazyLock;
|
||||||
use std::sync::Mutex;
|
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()));
|
static PLUGIN_METHODS: LazyLock<Mutex<Vec<String>>> = LazyLock::new(|| Mutex::new(Vec::new()));
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use chunk::ChunkConfig;
|
|||||||
use log::warn;
|
use log::warn;
|
||||||
use logging::LoggingConfig;
|
use logging::LoggingConfig;
|
||||||
use pumpkin_util::{Difficulty, GameMode, PermissionLvl};
|
use pumpkin_util::{Difficulty, GameMode, PermissionLvl};
|
||||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
use serde::{Deserialize, Serialize, de::DeserializeOwned};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
env, fs,
|
env, fs,
|
||||||
@ -184,14 +184,15 @@ impl LoadConfiguration for BasicConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn validate(&self) {
|
fn validate(&self) {
|
||||||
|
let min = unsafe { NonZeroU8::new_unchecked(2) };
|
||||||
|
let max = unsafe { NonZeroU8::new_unchecked(32) };
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
self.view_distance
|
self.view_distance.ge(&min),
|
||||||
.ge(unsafe { &NonZeroU8::new_unchecked(2) }),
|
|
||||||
"View distance must be at least 2"
|
"View distance must be at least 2"
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
self.view_distance
|
self.view_distance.le(&max),
|
||||||
.le(unsafe { &NonZeroU8::new_unchecked(32) }),
|
|
||||||
"View distance must be less than 32"
|
"View distance must be less than 32"
|
||||||
);
|
);
|
||||||
if self.online_mode {
|
if self.online_mode {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use quote::{format_ident, quote, ToTokens};
|
use quote::{ToTokens, format_ident, quote};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use syn::LitInt;
|
use syn::LitInt;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use heck::ToShoutySnakeCase;
|
use heck::ToShoutySnakeCase;
|
||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::{Span, TokenStream};
|
||||||
use quote::{format_ident, quote, ToTokens};
|
use quote::{ToTokens, format_ident, quote};
|
||||||
use syn::{Ident, LitBool, LitFloat, LitInt, LitStr};
|
use syn::{Ident, LitBool, LitFloat, LitInt, LitStr};
|
||||||
|
|
||||||
include!("../src/tag.rs");
|
include!("../src/tag.rs");
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
use pumpkin_data::{
|
use pumpkin_data::{
|
||||||
item::Item,
|
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 pumpkin_world::item::ItemStack;
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use crate::crafting::check_if_matches_crafting;
|
|
||||||
use crate::Container;
|
use crate::Container;
|
||||||
|
use crate::crafting::check_if_matches_crafting;
|
||||||
use pumpkin_data::screen::WindowType;
|
use pumpkin_data::screen::WindowType;
|
||||||
use pumpkin_util::math::position::BlockPos;
|
use pumpkin_util::math::position::BlockPos;
|
||||||
use pumpkin_world::block::registry::Block;
|
use pumpkin_world::block::registry::Block;
|
||||||
@ -34,11 +34,7 @@ impl OpenContainer {
|
|||||||
|
|
||||||
pub fn remove_player(&mut self, player_id: i32) {
|
pub fn remove_player(&mut self, player_id: i32) {
|
||||||
if let Some(index) = self.players.iter().enumerate().find_map(|(index, id)| {
|
if let Some(index) = self.players.iter().enumerate().find_map(|(index, id)| {
|
||||||
if *id == player_id {
|
if *id == player_id { Some(index) } else { None }
|
||||||
Some(index)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}) {
|
}) {
|
||||||
self.players.remove(index);
|
self.players.remove(index);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use crate::container_click::MouseClick;
|
use crate::container_click::MouseClick;
|
||||||
use crate::crafting::check_if_matches_crafting;
|
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_data::item::Item;
|
||||||
use pumpkin_world::item::ItemStack;
|
use pumpkin_world::item::ItemStack;
|
||||||
use std::iter::Chain;
|
use std::iter::Chain;
|
||||||
|
|||||||
@ -3,8 +3,9 @@ use proc_macro::TokenStream;
|
|||||||
use pumpkin_data::item::Item;
|
use pumpkin_data::item::Item;
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use syn::{
|
use syn::{
|
||||||
|
Block, Expr, Field, Fields, ItemStruct, Stmt,
|
||||||
parse::{Nothing, Parser},
|
parse::{Nothing, Parser},
|
||||||
parse_macro_input, Block, Expr, Field, Fields, ItemStruct, Stmt,
|
parse_macro_input,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern crate proc_macro;
|
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 input: proc_macro2::TokenStream = input.into();
|
||||||
let item: proc_macro2::TokenStream = item.into();
|
let item: proc_macro2::TokenStream = item.into();
|
||||||
|
|
||||||
let gen = quote! {
|
let code = quote! {
|
||||||
#item
|
#item
|
||||||
impl #impl_generics crate::bytebuf::packet::Packet for #name #ty_generics {
|
impl #impl_generics crate::bytebuf::packet::Packet for #name #ty_generics {
|
||||||
const PACKET_ID: i32 = #input;
|
const PACKET_ID: i32 = #input;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gen.into()
|
code.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[proc_macro_attribute]
|
#[proc_macro_attribute]
|
||||||
@ -180,14 +181,14 @@ pub fn server_packet(input: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
let input: proc_macro2::TokenStream = input.into();
|
let input: proc_macro2::TokenStream = input.into();
|
||||||
let item: proc_macro2::TokenStream = item.into();
|
let item: proc_macro2::TokenStream = item.into();
|
||||||
|
|
||||||
let gen = quote! {
|
let code = quote! {
|
||||||
#item
|
#item
|
||||||
impl #impl_generics crate::bytebuf::packet::Packet for #name #ty_generics {
|
impl #impl_generics crate::bytebuf::packet::Packet for #name #ty_generics {
|
||||||
const PACKET_ID: i32 = #input;
|
const PACKET_ID: i32 = #input;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gen.into()
|
code.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[proc_macro_attribute]
|
#[proc_macro_attribute]
|
||||||
@ -205,7 +206,7 @@ pub fn pumpkin_block(input: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
let item: proc_macro2::TokenStream = item.into();
|
let item: proc_macro2::TokenStream = item.into();
|
||||||
|
|
||||||
let gen = quote! {
|
let code = quote! {
|
||||||
#item
|
#item
|
||||||
impl #impl_generics crate::block::pumpkin_block::BlockMetadata for #name #ty_generics {
|
impl #impl_generics crate::block::pumpkin_block::BlockMetadata for #name #ty_generics {
|
||||||
const NAMESPACE: &'static str = #namespace;
|
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]
|
#[proc_macro_attribute]
|
||||||
@ -229,14 +230,14 @@ pub fn pumpkin_item(input: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
let item: proc_macro2::TokenStream = item.into();
|
let item: proc_macro2::TokenStream = item.into();
|
||||||
|
|
||||||
let gen = quote! {
|
let code = quote! {
|
||||||
#item
|
#item
|
||||||
impl #impl_generics crate::item::pumpkin_item::ItemMetadata for #name #ty_generics {
|
impl #impl_generics crate::item::pumpkin_item::ItemMetadata for #name #ty_generics {
|
||||||
const ID: u16 = #id;
|
const ID: u16 = #id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gen.into()
|
code.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[proc_macro_attribute]
|
#[proc_macro_attribute]
|
||||||
@ -351,7 +352,7 @@ pub fn block_property(input: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let gen = quote! {
|
let code = quote! {
|
||||||
#item
|
#item
|
||||||
impl #impl_generics crate::block::properties::BlockPropertyMetadata for #name #ty_generics {
|
impl #impl_generics crate::block::properties::BlockPropertyMetadata for #name #ty_generics {
|
||||||
fn name(&self) -> &'static str {
|
fn name(&self) -> &'static str {
|
||||||
@ -372,7 +373,7 @@ pub fn block_property(input: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
#extra
|
#extra
|
||||||
};
|
};
|
||||||
|
|
||||||
gen.into()
|
code.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
mod block_state;
|
mod block_state;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use crate::deserializer::ReadAdaptor;
|
use crate::deserializer::ReadAdaptor;
|
||||||
use crate::serializer::WriteAdaptor;
|
use crate::serializer::WriteAdaptor;
|
||||||
use crate::tag::NbtTag;
|
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::io::{ErrorKind, Read, Write};
|
||||||
use std::vec::IntoIter;
|
use std::vec::IntoIter;
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use crate::*;
|
use crate::*;
|
||||||
use io::Read;
|
use io::Read;
|
||||||
use serde::de::{self, DeserializeSeed, IntoDeserializer, MapAccess, SeqAccess, Visitor};
|
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>;
|
pub type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
||||||
|
|||||||
@ -210,13 +210,13 @@ impl_array!(nbt_byte_array, NBT_BYTE_ARRAY_TAG);
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
|
||||||
|
use crate::Error;
|
||||||
use crate::deserializer::from_bytes;
|
use crate::deserializer::from_bytes;
|
||||||
use crate::nbt_byte_array;
|
use crate::nbt_byte_array;
|
||||||
use crate::nbt_int_array;
|
use crate::nbt_int_array;
|
||||||
use crate::nbt_long_array;
|
use crate::nbt_long_array;
|
||||||
use crate::serializer::to_bytes;
|
use crate::serializer::to_bytes;
|
||||||
use crate::serializer::to_bytes_named;
|
use crate::serializer::to_bytes_named;
|
||||||
use crate::Error;
|
|
||||||
use crate::{deserializer::from_bytes_unnamed, serializer::to_bytes_unnamed};
|
use crate::{deserializer::from_bytes_unnamed, serializer::to_bytes_unnamed};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
use serde::ser::Impossible;
|
use serde::ser::Impossible;
|
||||||
use serde::{ser, Serialize};
|
use serde::{Serialize, ser};
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
use crate::tag::NbtTag;
|
use crate::tag::NbtTag;
|
||||||
use crate::{
|
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,
|
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,
|
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(
|
return Err(Error::SerdeError(
|
||||||
"Array supports only byte, int, long".to_string(),
|
"Array supports only byte, int, long".to_string(),
|
||||||
))
|
));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
use core::str;
|
use core::str;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
codec::{
|
|
||||||
bit_set::BitSet, identifier::Identifier, var_int::VarInt, var_long::VarLong, Codec,
|
|
||||||
DecodeError,
|
|
||||||
},
|
|
||||||
FixedBitSet,
|
FixedBitSet,
|
||||||
|
codec::{
|
||||||
|
Codec, DecodeError, bit_set::BitSet, identifier::Identifier, var_int::VarInt,
|
||||||
|
var_long::VarLong,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use bytes::{Buf, BufMut};
|
use bytes::{Buf, BufMut};
|
||||||
|
|
||||||
@ -279,8 +279,8 @@ mod test {
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bytebuf::{deserializer, serializer},
|
|
||||||
VarInt,
|
VarInt,
|
||||||
|
bytebuf::{deserializer, serializer},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
use bytes::{Buf, BufMut};
|
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 {
|
pub trait Packet {
|
||||||
const PACKET_ID: VarIntType;
|
const PACKET_ID: VarIntType;
|
||||||
|
|||||||
@ -2,8 +2,8 @@ use std::fmt::Display;
|
|||||||
|
|
||||||
use bytes::BufMut;
|
use bytes::BufMut;
|
||||||
use serde::{
|
use serde::{
|
||||||
ser::{self},
|
|
||||||
Serialize,
|
Serialize,
|
||||||
|
ser::{self},
|
||||||
};
|
};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use bytes::BufMut;
|
|||||||
use pumpkin_data::packet::clientbound::CONFIG_SELECT_KNOWN_PACKS;
|
use pumpkin_data::packet::clientbound::CONFIG_SELECT_KNOWN_PACKS;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
|
|
||||||
use crate::{bytebuf::ByteBufMut, ClientPacket, KnownPack};
|
use crate::{ClientPacket, KnownPack, bytebuf::ByteBufMut};
|
||||||
|
|
||||||
#[client_packet(CONFIG_SELECT_KNOWN_PACKS)]
|
#[client_packet(CONFIG_SELECT_KNOWN_PACKS)]
|
||||||
pub struct CKnownPacks<'a> {
|
pub struct CKnownPacks<'a> {
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use pumpkin_data::packet::clientbound::CONFIG_REGISTRY_DATA;
|
|||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::{bytebuf::ByteBufMut, codec::identifier::Identifier, ClientPacket};
|
use crate::{ClientPacket, bytebuf::ByteBufMut, codec::identifier::Identifier};
|
||||||
|
|
||||||
#[client_packet(CONFIG_REGISTRY_DATA)]
|
#[client_packet(CONFIG_REGISTRY_DATA)]
|
||||||
pub struct CRegistryData<'a> {
|
pub struct CRegistryData<'a> {
|
||||||
|
|||||||
@ -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_data::packet::clientbound::CONFIG_STORE_COOKIE;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
|
|
||||||
|
|||||||
@ -8,9 +8,9 @@ use pumpkin_macros::client_packet;
|
|||||||
use pumpkin_world::block::registry;
|
use pumpkin_world::block::registry;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ClientPacket,
|
||||||
bytebuf::ByteBufMut,
|
bytebuf::ByteBufMut,
|
||||||
codec::{identifier::Identifier, var_int::VarInt},
|
codec::{identifier::Identifier, var_int::VarInt},
|
||||||
ClientPacket,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[client_packet(CONFIG_UPDATE_TAGS)]
|
#[client_packet(CONFIG_UPDATE_TAGS)]
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use bytes::BufMut;
|
|||||||
use pumpkin_data::packet::clientbound::LOGIN_LOGIN_FINISHED;
|
use pumpkin_data::packet::clientbound::LOGIN_LOGIN_FINISHED;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
|
|
||||||
use crate::{bytebuf::ByteBufMut, ClientPacket, Property};
|
use crate::{ClientPacket, Property, bytebuf::ByteBufMut};
|
||||||
|
|
||||||
#[client_packet(LOGIN_LOGIN_FINISHED)]
|
#[client_packet(LOGIN_LOGIN_FINISHED)]
|
||||||
pub struct CLoginSuccess<'a> {
|
pub struct CLoginSuccess<'a> {
|
||||||
|
|||||||
@ -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 bytes::{BufMut, BytesMut};
|
||||||
use pumpkin_data::packet::clientbound::PLAY_LEVEL_CHUNK_WITH_LIGHT;
|
use pumpkin_data::packet::clientbound::PLAY_LEVEL_CHUNK_WITH_LIGHT;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use pumpkin_world::{
|
use pumpkin_world::{
|
||||||
chunk::{ChunkData, SUBCHUNKS_COUNT},
|
|
||||||
DIRECT_PALETTE_BITS,
|
DIRECT_PALETTE_BITS,
|
||||||
|
chunk::{ChunkData, SUBCHUNKS_COUNT},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[client_packet(PLAY_LEVEL_CHUNK_WITH_LIGHT)]
|
#[client_packet(PLAY_LEVEL_CHUNK_WITH_LIGHT)]
|
||||||
@ -73,7 +73,7 @@ impl ClientPacket for CChunkData<'_> {
|
|||||||
.iter()
|
.iter()
|
||||||
.position(|b| b == block)
|
.position(|b| b == block)
|
||||||
.expect("Its just got added, ofc it should be there");
|
.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);
|
data_buf.put_i64(out_long);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use pumpkin_data::packet::clientbound::PLAY_COMMAND_SUGGESTIONS;
|
|||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use pumpkin_util::text::TextComponent;
|
use pumpkin_util::text::TextComponent;
|
||||||
|
|
||||||
use crate::{bytebuf::ByteBufMut, ClientPacket, VarInt};
|
use crate::{ClientPacket, VarInt, bytebuf::ByteBufMut};
|
||||||
|
|
||||||
#[client_packet(PLAY_COMMAND_SUGGESTIONS)]
|
#[client_packet(PLAY_COMMAND_SUGGESTIONS)]
|
||||||
pub struct CCommandSuggestions {
|
pub struct CCommandSuggestions {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use bytes::BufMut;
|
|||||||
use pumpkin_data::packet::clientbound::PLAY_COMMANDS;
|
use pumpkin_data::packet::clientbound::PLAY_COMMANDS;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
|
|
||||||
use crate::{bytebuf::ByteBufMut, ClientPacket, VarInt};
|
use crate::{ClientPacket, VarInt, bytebuf::ByteBufMut};
|
||||||
|
|
||||||
#[client_packet(PLAY_COMMANDS)]
|
#[client_packet(PLAY_COMMANDS)]
|
||||||
pub struct CCommands<'a> {
|
pub struct CCommands<'a> {
|
||||||
@ -114,12 +114,19 @@ impl ProtoNode<'_> {
|
|||||||
|
|
||||||
if flags & Self::FLAG_HAS_SUGGESTION_TYPE != 0 {
|
if flags & Self::FLAG_HAS_SUGGESTION_TYPE != 0 {
|
||||||
match &self.node_type {
|
match &self.node_type {
|
||||||
ProtoNodeType::Argument { name: _, is_executable: _, parser: _, override_suggestion_type } => {
|
ProtoNodeType::Argument {
|
||||||
|
name: _,
|
||||||
|
is_executable: _,
|
||||||
|
parser: _,
|
||||||
|
override_suggestion_type,
|
||||||
|
} => {
|
||||||
// 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.");
|
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());
|
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"
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use bytes::BufMut;
|
|||||||
use pumpkin_data::{packet::clientbound::PLAY_SOUND_ENTITY, sound::SoundCategory};
|
use pumpkin_data::{packet::clientbound::PLAY_SOUND_ENTITY, sound::SoundCategory};
|
||||||
use pumpkin_macros::client_packet;
|
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)]
|
#[client_packet(PLAY_SOUND_ENTITY)]
|
||||||
pub struct CEntitySoundEffect {
|
pub struct CEntitySoundEffect {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use pumpkin_data::packet::clientbound::PLAY_INITIALIZE_BORDER;
|
|||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::{codec::var_long::VarLong, VarInt};
|
use crate::{VarInt, codec::var_long::VarLong};
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
#[client_packet(PLAY_INITIALIZE_BORDER)]
|
#[client_packet(PLAY_INITIALIZE_BORDER)]
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use pumpkin_util::math::position::BlockPos;
|
|||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::{codec::identifier::Identifier, VarInt};
|
use crate::{VarInt, codec::identifier::Identifier};
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
#[client_packet(PLAY_LOGIN)]
|
#[client_packet(PLAY_LOGIN)]
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use pumpkin_util::text::TextComponent;
|
|||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::{codec::bit_set::BitSet, VarInt};
|
use crate::{VarInt, codec::bit_set::BitSet};
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
#[client_packet(PLAY_PLAYER_CHAT)]
|
#[client_packet(PLAY_PLAYER_CHAT)]
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use bytes::BufMut;
|
|||||||
use pumpkin_data::packet::clientbound::PLAY_PLAYER_INFO_UPDATE;
|
use pumpkin_data::packet::clientbound::PLAY_PLAYER_INFO_UPDATE;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
|
|
||||||
use crate::{bytebuf::ByteBufMut, ClientPacket, Property};
|
use crate::{ClientPacket, Property, bytebuf::ByteBufMut};
|
||||||
|
|
||||||
use super::PlayerAction;
|
use super::PlayerAction;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use pumpkin_data::packet::clientbound::PLAY_PLAYER_POSITION;
|
|||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use pumpkin_util::math::vector3::Vector3;
|
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)]
|
#[client_packet(PLAY_PLAYER_POSITION)]
|
||||||
pub struct CPlayerPosition<'a> {
|
pub struct CPlayerPosition<'a> {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use pumpkin_data::packet::clientbound::PLAY_PLAYER_INFO_REMOVE;
|
use pumpkin_data::packet::clientbound::PLAY_PLAYER_INFO_REMOVE;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use serde::{ser::SerializeSeq, Serialize};
|
use serde::{Serialize, ser::SerializeSeq};
|
||||||
|
|
||||||
use crate::VarInt;
|
use crate::VarInt;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use pumpkin_macros::client_packet;
|
|||||||
use pumpkin_util::math::position::BlockPos;
|
use pumpkin_util::math::position::BlockPos;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::{codec::identifier::Identifier, VarInt};
|
use crate::{VarInt, codec::identifier::Identifier};
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
#[client_packet(PLAY_RESPAWN)]
|
#[client_packet(PLAY_RESPAWN)]
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use crate::codec::slot::Slot;
|
|
||||||
use crate::VarInt;
|
use crate::VarInt;
|
||||||
|
use crate::codec::slot::Slot;
|
||||||
|
|
||||||
use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_CONTENT;
|
use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_CONTENT;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use crate::codec::slot::Slot;
|
|
||||||
use crate::VarInt;
|
use crate::VarInt;
|
||||||
|
use crate::codec::slot::Slot;
|
||||||
|
|
||||||
use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_SLOT;
|
use pumpkin_data::packet::clientbound::PLAY_CONTAINER_SET_SLOT;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
use crate::bytebuf::{serializer::Serializer, ByteBufMut};
|
use crate::bytebuf::{ByteBufMut, serializer::Serializer};
|
||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
use pumpkin_data::packet::clientbound::PLAY_SET_EQUIPMENT;
|
use pumpkin_data::packet::clientbound::PLAY_SET_EQUIPMENT;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
codec::{slot::Slot, var_int::VarInt},
|
|
||||||
ClientPacket,
|
ClientPacket,
|
||||||
|
codec::{slot::Slot, var_int::VarInt},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[client_packet(PLAY_SET_EQUIPMENT)]
|
#[client_packet(PLAY_SET_EQUIPMENT)]
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use pumpkin_data::{packet::clientbound::PLAY_SOUND, sound::SoundCategory};
|
|||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use pumpkin_util::math::vector3::Vector3;
|
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)]
|
#[client_packet(PLAY_SOUND)]
|
||||||
pub struct CSoundEffect {
|
pub struct CSoundEffect {
|
||||||
|
|||||||
@ -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_data::packet::clientbound::PLAY_STORE_COOKIE;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use pumpkin_data::packet::clientbound::PLAY_TELEPORT_ENTITY;
|
|||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use pumpkin_util::math::vector3::Vector3;
|
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)]
|
#[client_packet(PLAY_TELEPORT_ENTITY)]
|
||||||
pub struct CTeleportEntity<'a> {
|
pub struct CTeleportEntity<'a> {
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use pumpkin_data::packet::clientbound::PLAY_SET_OBJECTIVE;
|
|||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
use pumpkin_util::text::TextComponent;
|
use pumpkin_util::text::TextComponent;
|
||||||
|
|
||||||
use crate::{bytebuf::ByteBufMut, ClientPacket, NumberFormat, VarInt};
|
use crate::{ClientPacket, NumberFormat, VarInt, bytebuf::ByteBufMut};
|
||||||
|
|
||||||
#[client_packet(PLAY_SET_OBJECTIVE)]
|
#[client_packet(PLAY_SET_OBJECTIVE)]
|
||||||
pub struct CUpdateObjectives<'a> {
|
pub struct CUpdateObjectives<'a> {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ use serde::{Serialize, Serializer};
|
|||||||
use crate::bytebuf::ByteBuf;
|
use crate::bytebuf::ByteBuf;
|
||||||
use crate::bytebuf::ByteBufMut;
|
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>);
|
pub struct BitSet(pub VarInt, pub Vec<i64>);
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use std::num::NonZeroUsize;
|
use std::num::NonZeroUsize;
|
||||||
|
|
||||||
use bytes::{Buf, BufMut};
|
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};
|
use crate::bytebuf::{ByteBuf, ByteBufMut};
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,8 @@ use pumpkin_data::item::Item;
|
|||||||
use pumpkin_world::item::ItemStack;
|
use pumpkin_world::item::ItemStack;
|
||||||
use serde::ser::SerializeSeq;
|
use serde::ser::SerializeSeq;
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{self, SeqAccess},
|
|
||||||
Deserialize, Serialize, Serializer,
|
Deserialize, Serialize, Serializer,
|
||||||
|
de::{self, SeqAccess},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|||||||
@ -3,8 +3,8 @@ use std::{num::NonZeroUsize, ops::Deref};
|
|||||||
use super::{Codec, DecodeError};
|
use super::{Codec, DecodeError};
|
||||||
use bytes::{Buf, BufMut};
|
use bytes::{Buf, BufMut};
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{SeqAccess, Visitor},
|
|
||||||
Deserialize, Deserializer, Serialize, Serializer,
|
Deserialize, Deserializer, Serialize, Serializer,
|
||||||
|
de::{SeqAccess, Visitor},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type VarIntType = i32;
|
pub type VarIntType = i32;
|
||||||
|
|||||||
@ -3,8 +3,8 @@ use std::{num::NonZeroUsize, ops::Deref};
|
|||||||
use super::{Codec, DecodeError};
|
use super::{Codec, DecodeError};
|
||||||
use bytes::{Buf, BufMut};
|
use bytes::{Buf, BufMut};
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{self, SeqAccess, Visitor},
|
|
||||||
Deserialize, Deserializer, Serialize, Serializer,
|
Deserialize, Deserializer, Serialize, Serializer,
|
||||||
|
de::{self, SeqAccess, Visitor},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type VarLongType = i64;
|
pub type VarLongType = i64;
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
use std::num::NonZeroU16;
|
use std::num::NonZeroU16;
|
||||||
|
|
||||||
use bytebuf::{packet::Packet, ReadingError};
|
use bytebuf::{ReadingError, packet::Packet};
|
||||||
use bytes::{Buf, BufMut, Bytes};
|
use bytes::{Buf, BufMut, Bytes};
|
||||||
use codec::{identifier::Identifier, var_int::VarInt};
|
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};
|
use serde::{Deserialize, Serialize, Serializer};
|
||||||
|
|
||||||
pub mod bytebuf;
|
pub mod bytebuf;
|
||||||
|
|||||||
@ -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 bytes::{Buf, Bytes, BytesMut};
|
||||||
use libdeflater::{DecompressionError, Decompressor};
|
use libdeflater::{DecompressionError, Decompressor};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
MAX_PACKET_SIZE, RawPacket, VarInt,
|
||||||
codec::{Codec, DecodeError},
|
codec::{Codec, DecodeError},
|
||||||
RawPacket, VarInt, MAX_PACKET_SIZE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type Cipher = cfb8::Decryptor<aes::Aes128>;
|
type Cipher = cfb8::Decryptor<aes::Aes128>;
|
||||||
@ -193,8 +193,8 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use aes::Aes128;
|
use aes::Aes128;
|
||||||
use bytes::BufMut;
|
use bytes::BufMut;
|
||||||
use cfb8::cipher::AsyncStreamCipher;
|
|
||||||
use cfb8::Encryptor as Cfb8Encryptor;
|
use cfb8::Encryptor as Cfb8Encryptor;
|
||||||
|
use cfb8::cipher::AsyncStreamCipher;
|
||||||
use libdeflater::{CompressionLvl, Compressor};
|
use libdeflater::{CompressionLvl, Compressor};
|
||||||
|
|
||||||
/// Helper function to compress data using libdeflater's Zlib compressor
|
/// Helper function to compress data using libdeflater's Zlib compressor
|
||||||
|
|||||||
@ -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 bytes::{BufMut, BytesMut};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use libdeflater::{CompressionLvl, Compressor};
|
use libdeflater::{CompressionLvl, Compressor};
|
||||||
|
|
||||||
use crate::{
|
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>;
|
type Cipher = cfb8::Encryptor<aes::Aes128>;
|
||||||
@ -218,8 +218,8 @@ mod tests {
|
|||||||
use crate::client::status::CStatusResponse;
|
use crate::client::status::CStatusResponse;
|
||||||
use crate::{bytebuf::packet::Packet, codec::DecodeError};
|
use crate::{bytebuf::packet::Packet, codec::DecodeError};
|
||||||
use aes::Aes128;
|
use aes::Aes128;
|
||||||
use cfb8::cipher::AsyncStreamCipher;
|
|
||||||
use cfb8::Decryptor as Cfb8Decryptor;
|
use cfb8::Decryptor as Cfb8Decryptor;
|
||||||
|
use cfb8::cipher::AsyncStreamCipher;
|
||||||
use libdeflater::{DecompressionError, Decompressor};
|
use libdeflater::{DecompressionError, Decompressor};
|
||||||
use pumpkin_data::packet::clientbound::STATUS_STATUS_RESPONSE;
|
use pumpkin_data::packet::clientbound::STATUS_STATUS_RESPONSE;
|
||||||
use pumpkin_macros::client_packet;
|
use pumpkin_macros::client_packet;
|
||||||
|
|||||||
@ -3,9 +3,9 @@ use pumpkin_data::packet::serverbound::CONFIG_COOKIE_RESPONSE;
|
|||||||
use pumpkin_macros::server_packet;
|
use pumpkin_macros::server_packet;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ServerPacket, VarInt,
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
codec::identifier::Identifier,
|
codec::identifier::Identifier,
|
||||||
ServerPacket, VarInt,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[server_packet(CONFIG_COOKIE_RESPONSE)]
|
#[server_packet(CONFIG_COOKIE_RESPONSE)]
|
||||||
|
|||||||
@ -3,9 +3,9 @@ use pumpkin_data::packet::serverbound::CONFIG_CUSTOM_PAYLOAD;
|
|||||||
use pumpkin_macros::server_packet;
|
use pumpkin_macros::server_packet;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
ServerPacket,
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
codec::identifier::Identifier,
|
codec::identifier::Identifier,
|
||||||
ServerPacket,
|
|
||||||
};
|
};
|
||||||
const MAX_PAYLOAD_SIZE: usize = 1048576;
|
const MAX_PAYLOAD_SIZE: usize = 1048576;
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,8 @@ use pumpkin_data::packet::serverbound::HANDSHAKE_INTENTION;
|
|||||||
use pumpkin_macros::server_packet;
|
use pumpkin_macros::server_packet;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
|
||||||
ConnectionState, ServerPacket, VarInt,
|
ConnectionState, ServerPacket, VarInt,
|
||||||
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[server_packet(HANDSHAKE_INTENTION)]
|
#[server_packet(HANDSHAKE_INTENTION)]
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
|
ServerPacket, VarInt,
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
codec::identifier::Identifier,
|
codec::identifier::Identifier,
|
||||||
ServerPacket, VarInt,
|
|
||||||
};
|
};
|
||||||
use bytes::Buf;
|
use bytes::Buf;
|
||||||
use pumpkin_data::packet::serverbound::LOGIN_COOKIE_RESPONSE;
|
use pumpkin_data::packet::serverbound::LOGIN_COOKIE_RESPONSE;
|
||||||
|
|||||||
@ -3,8 +3,8 @@ use pumpkin_data::packet::serverbound::LOGIN_KEY;
|
|||||||
use pumpkin_macros::server_packet;
|
use pumpkin_macros::server_packet;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
|
||||||
ServerPacket, VarInt,
|
ServerPacket, VarInt,
|
||||||
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[server_packet(LOGIN_KEY)]
|
#[server_packet(LOGIN_KEY)]
|
||||||
|
|||||||
@ -3,8 +3,8 @@ use pumpkin_data::packet::serverbound::LOGIN_HELLO;
|
|||||||
use pumpkin_macros::server_packet;
|
use pumpkin_macros::server_packet;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
|
||||||
ServerPacket,
|
ServerPacket,
|
||||||
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[server_packet(LOGIN_HELLO)]
|
#[server_packet(LOGIN_HELLO)]
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
|
||||||
ServerPacket, VarInt,
|
ServerPacket, VarInt,
|
||||||
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
};
|
};
|
||||||
use bytes::{Buf, Bytes};
|
use bytes::{Buf, Bytes};
|
||||||
use pumpkin_data::packet::serverbound::LOGIN_CUSTOM_QUERY_ANSWER;
|
use pumpkin_data::packet::serverbound::LOGIN_CUSTOM_QUERY_ANSWER;
|
||||||
|
|||||||
@ -3,8 +3,8 @@ use pumpkin_data::packet::serverbound::PLAY_CHAT;
|
|||||||
use pumpkin_macros::server_packet;
|
use pumpkin_macros::server_packet;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
|
||||||
FixedBitSet, ServerPacket, VarInt,
|
FixedBitSet, ServerPacket, VarInt,
|
||||||
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
};
|
};
|
||||||
|
|
||||||
// derive(Deserialize)]
|
// derive(Deserialize)]
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
use crate::codec::slot::Slot;
|
|
||||||
use crate::VarInt;
|
use crate::VarInt;
|
||||||
|
use crate::codec::slot::Slot;
|
||||||
use pumpkin_data::packet::serverbound::PLAY_CONTAINER_CLICK;
|
use pumpkin_data::packet::serverbound::PLAY_CONTAINER_CLICK;
|
||||||
use pumpkin_macros::server_packet;
|
use pumpkin_macros::server_packet;
|
||||||
use serde::de::SeqAccess;
|
use serde::de::SeqAccess;
|
||||||
use serde::{de, Deserialize};
|
use serde::{Deserialize, de};
|
||||||
|
|
||||||
#[server_packet(PLAY_CONTAINER_CLICK)]
|
#[server_packet(PLAY_CONTAINER_CLICK)]
|
||||||
pub struct SClickContainer {
|
pub struct SClickContainer {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
|
ServerPacket, VarInt,
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
codec::identifier::Identifier,
|
codec::identifier::Identifier,
|
||||||
ServerPacket, VarInt,
|
|
||||||
};
|
};
|
||||||
use bytes::Buf;
|
use bytes::Buf;
|
||||||
use pumpkin_data::packet::serverbound::PLAY_COOKIE_RESPONSE;
|
use pumpkin_data::packet::serverbound::PLAY_COOKIE_RESPONSE;
|
||||||
|
|||||||
@ -4,8 +4,8 @@ use pumpkin_macros::server_packet;
|
|||||||
use pumpkin_util::math::vector3::Vector3;
|
use pumpkin_util::math::vector3::Vector3;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
|
||||||
ServerPacket, VarInt,
|
ServerPacket, VarInt,
|
||||||
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[server_packet(PLAY_INTERACT)]
|
#[server_packet(PLAY_INTERACT)]
|
||||||
|
|||||||
@ -3,8 +3,8 @@ use pumpkin_data::packet::serverbound::PLAY_PLAYER_COMMAND;
|
|||||||
use pumpkin_macros::server_packet;
|
use pumpkin_macros::server_packet;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
|
||||||
ServerPacket, VarInt,
|
ServerPacket, VarInt,
|
||||||
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[server_packet(PLAY_PLAYER_COMMAND)]
|
#[server_packet(PLAY_PLAYER_COMMAND)]
|
||||||
|
|||||||
@ -4,8 +4,8 @@ use pumpkin_macros::server_packet;
|
|||||||
use pumpkin_util::math::position::BlockPos;
|
use pumpkin_util::math::position::BlockPos;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bytebuf::{ByteBuf, ReadingError},
|
|
||||||
ServerPacket,
|
ServerPacket,
|
||||||
|
bytebuf::{ByteBuf, ReadingError},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[server_packet(PLAY_SIGN_UPDATE)]
|
#[server_packet(PLAY_SIGN_UPDATE)]
|
||||||
|
|||||||
@ -11,7 +11,7 @@ use instrument::Instrument;
|
|||||||
use jukebox_song::JukeboxSong;
|
use jukebox_song::JukeboxSong;
|
||||||
use paint::Painting;
|
use paint::Painting;
|
||||||
use pumpkin_protocol::{client::config::RegistryEntry, codec::identifier::Identifier};
|
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 serde::{Deserialize, Serialize};
|
||||||
use trim_material::TrimMaterial;
|
use trim_material::TrimMaterial;
|
||||||
use trim_pattern::TrimPattern;
|
use trim_pattern::TrimPattern;
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
use crate::flatten_3x3;
|
use crate::flatten_3x3;
|
||||||
use crate::recipe::read::ingredients::Ingredients;
|
|
||||||
use crate::recipe::read::SpecialCraftingType::{
|
use crate::recipe::read::SpecialCraftingType::{
|
||||||
ArmorDye, BannerDuplicate, BookCloning, Firework, RepairItem, ShieldDecoration,
|
ArmorDye, BannerDuplicate, BookCloning, Firework, RepairItem, ShieldDecoration,
|
||||||
ShulkerboxColoring, SuspiciousStew, TippedArrow,
|
ShulkerboxColoring, SuspiciousStew, TippedArrow,
|
||||||
};
|
};
|
||||||
|
use crate::recipe::read::ingredients::Ingredients;
|
||||||
use crate::recipe::recipe_formats::{ShapedCrafting, ShapelessCrafting};
|
use crate::recipe::recipe_formats::{ShapedCrafting, ShapelessCrafting};
|
||||||
use pumpkin_data::tag::RegistryEntryList;
|
use pumpkin_data::tag::RegistryEntryList;
|
||||||
use serde::de::{Error, MapAccess, Visitor};
|
use serde::de::{Error, MapAccess, Visitor};
|
||||||
use serde::{de, Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer, de};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt::Formatter;
|
use std::fmt::Formatter;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use super::{
|
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 {
|
pub struct LegacyRand {
|
||||||
@ -121,7 +121,7 @@ impl RandomDeriverImpl for LegacySplitter {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate::random::{legacy_rand::LegacySplitter, RandomDeriverImpl, RandomImpl};
|
use crate::random::{RandomDeriverImpl, RandomImpl, legacy_rand::LegacySplitter};
|
||||||
|
|
||||||
use super::LegacyRand;
|
use super::LegacyRand;
|
||||||
|
|
||||||
|
|||||||
@ -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 {
|
pub struct Xoroshiro {
|
||||||
lo: u64,
|
lo: u64,
|
||||||
@ -154,7 +154,7 @@ impl RandomDeriverImpl for XoroshiroSplitter {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use crate::random::{RandomDeriverImpl, RandomImpl};
|
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
|
// Values checked against results from the equivalent Java source
|
||||||
|
|
||||||
|
|||||||
@ -266,7 +266,7 @@ pub enum TextContent {
|
|||||||
mod test {
|
mod test {
|
||||||
use pumpkin_nbt::serializer::to_bytes_unnamed;
|
use pumpkin_nbt::serializer::to_bytes_unnamed;
|
||||||
|
|
||||||
use crate::text::{color::NamedColor, TextComponent};
|
use crate::text::{TextComponent, color::NamedColor};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_serialize_text_component() {
|
fn test_serialize_text_component() {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use criterion::{criterion_group, criterion_main, Criterion};
|
use criterion::{Criterion, criterion_group, criterion_main};
|
||||||
use pumpkin_world::{
|
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) {
|
fn criterion_benchmark(c: &mut Criterion) {
|
||||||
|
|||||||
@ -505,9 +505,9 @@ mod tests {
|
|||||||
use temp_dir::TempDir;
|
use temp_dir::TempDir;
|
||||||
|
|
||||||
use crate::chunk::ChunkWriter;
|
use crate::chunk::ChunkWriter;
|
||||||
use crate::generation::{get_world_gen, Seed};
|
use crate::generation::{Seed, get_world_gen};
|
||||||
use crate::{
|
use crate::{
|
||||||
chunk::{anvil::AnvilChunkFormat, ChunkReader, ChunkReadingError},
|
chunk::{ChunkReader, ChunkReadingError, anvil::AnvilChunkFormat},
|
||||||
level::LevelFolder,
|
level::LevelFolder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -464,9 +464,9 @@ mod tests {
|
|||||||
use temp_dir::TempDir;
|
use temp_dir::TempDir;
|
||||||
|
|
||||||
use crate::chunk::ChunkWriter;
|
use crate::chunk::ChunkWriter;
|
||||||
use crate::generation::{get_world_gen, Seed};
|
use crate::generation::{Seed, get_world_gen};
|
||||||
use crate::{
|
use crate::{
|
||||||
chunk::{linear::LinearChunkFormat, ChunkReader, ChunkReadingError},
|
chunk::{ChunkReader, ChunkReadingError, linear::LinearChunkFormat},
|
||||||
level::LevelFolder,
|
level::LevelFolder,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use dashmap::{
|
use dashmap::{
|
||||||
mapref::one::{Ref, RefMut},
|
|
||||||
DashMap,
|
DashMap,
|
||||||
|
mapref::one::{Ref, RefMut},
|
||||||
};
|
};
|
||||||
use pumpkin_data::chunk::ChunkStatus;
|
use pumpkin_data::chunk::ChunkStatus;
|
||||||
use pumpkin_nbt::{deserializer::from_bytes, nbt_long_array};
|
use pumpkin_nbt::{deserializer::from_bytes, nbt_long_array};
|
||||||
@ -15,10 +15,10 @@ use std::{
|
|||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
WORLD_HEIGHT,
|
||||||
block::BlockState,
|
block::BlockState,
|
||||||
coordinates::{ChunkRelativeBlockCoordinates, Height},
|
coordinates::{ChunkRelativeBlockCoordinates, Height},
|
||||||
level::LevelFolder,
|
level::LevelFolder,
|
||||||
WORLD_HEIGHT,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod anvil;
|
pub mod anvil;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ use super::{
|
|||||||
chunk_noise_router::ChunkNoiseRouter,
|
chunk_noise_router::ChunkNoiseRouter,
|
||||||
density_function::{NoisePos, UnblendedNoisePos},
|
density_function::{NoisePos, UnblendedNoisePos},
|
||||||
},
|
},
|
||||||
positions::{block_pos, chunk_pos, MIN_HEIGHT_CELL},
|
positions::{MIN_HEIGHT_CELL, block_pos, chunk_pos},
|
||||||
proto_chunk::StandardChunkFluidLevelSampler,
|
proto_chunk::StandardChunkFluidLevelSampler,
|
||||||
section_coords,
|
section_coords,
|
||||||
};
|
};
|
||||||
@ -214,18 +214,10 @@ impl WorldAquiferSampler {
|
|||||||
|
|
||||||
let o = halved_diff - scaled_level.abs();
|
let o = halved_diff - scaled_level.abs();
|
||||||
let q = if scaled_level > 0f64 {
|
let q = if scaled_level > 0f64 {
|
||||||
if o > 0f64 {
|
if o > 0f64 { o / 1.5f64 } else { o / 2.5f64 }
|
||||||
o / 1.5f64
|
|
||||||
} else {
|
|
||||||
o / 2.5f64
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let p = 3f64 + o;
|
let p = 3f64 + o;
|
||||||
if p > 0f64 {
|
if p > 0f64 { p / 3f64 } else { p / 10f64 }
|
||||||
p / 3f64
|
|
||||||
} else {
|
|
||||||
p / 10f64
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let r = if (-2f64..=2f64).contains(&q) {
|
let r = if (-2f64..=2f64).contains(&q) {
|
||||||
@ -661,6 +653,7 @@ mod test {
|
|||||||
use crate::{
|
use crate::{
|
||||||
block::BlockState,
|
block::BlockState,
|
||||||
generation::{
|
generation::{
|
||||||
|
GlobalRandomConfig,
|
||||||
chunk_noise::{
|
chunk_noise::{
|
||||||
BlockStateSampler, ChainedBlockStateSampler, ChunkNoiseGenerator,
|
BlockStateSampler, ChainedBlockStateSampler, ChunkNoiseGenerator,
|
||||||
ChunkNoiseHeightEstimator, LAVA_BLOCK, WATER_BLOCK,
|
ChunkNoiseHeightEstimator, LAVA_BLOCK, WATER_BLOCK,
|
||||||
@ -674,7 +667,6 @@ mod test {
|
|||||||
},
|
},
|
||||||
positions::chunk_pos,
|
positions::chunk_pos,
|
||||||
proto_chunk::StandardChunkFluidLevelSampler,
|
proto_chunk::StandardChunkFluidLevelSampler,
|
||||||
GlobalRandomConfig,
|
|
||||||
},
|
},
|
||||||
noise_router::NOISE_ROUTER_ASTS,
|
noise_router::NOISE_ROUTER_ASTS,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,6 +6,7 @@ use pumpkin_util::math::{floor_div, floor_mod, vector2::Vector2};
|
|||||||
use crate::{block::BlockState, generation::section_coords};
|
use crate::{block::BlockState, generation::section_coords};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
GlobalRandomConfig,
|
||||||
aquifer_sampler::{
|
aquifer_sampler::{
|
||||||
AquiferSampler, AquiferSamplerImpl, FluidLevelSampler, SeaLevelAquiferSampler,
|
AquiferSampler, AquiferSamplerImpl, FluidLevelSampler, SeaLevelAquiferSampler,
|
||||||
WorldAquiferSampler,
|
WorldAquiferSampler,
|
||||||
@ -23,7 +24,6 @@ use super::{
|
|||||||
},
|
},
|
||||||
ore_sampler::OreVeinSampler,
|
ore_sampler::OreVeinSampler,
|
||||||
positions::chunk_pos,
|
positions::chunk_pos,
|
||||||
GlobalRandomConfig,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const STONE_BLOCK: BlockState = block_state!("stone");
|
pub const STONE_BLOCK: BlockState = block_state!("stone");
|
||||||
|
|||||||
@ -2,14 +2,14 @@ use noise::{NoiseFn, Perlin};
|
|||||||
use pumpkin_util::math::vector2::Vector2;
|
use pumpkin_util::math::vector2::Vector2;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
WORLD_LOWEST_Y,
|
||||||
chunk::{ChunkData, Subchunks},
|
chunk::{ChunkData, Subchunks},
|
||||||
coordinates::{ChunkRelativeBlockCoordinates, ChunkRelativeXZBlockCoordinates},
|
coordinates::{ChunkRelativeBlockCoordinates, ChunkRelativeXZBlockCoordinates},
|
||||||
WORLD_LOWEST_Y,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
generator::{BiomeGenerator, GeneratorInit, PerlinTerrainGenerator, WorldGenerator},
|
|
||||||
Seed,
|
Seed,
|
||||||
|
generator::{BiomeGenerator, GeneratorInit, PerlinTerrainGenerator, WorldGenerator},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct GenericGenerator<B: BiomeGenerator, T: PerlinTerrainGenerator> {
|
pub struct GenericGenerator<B: BiomeGenerator, T: PerlinTerrainGenerator> {
|
||||||
|
|||||||
@ -5,9 +5,9 @@ use crate::{
|
|||||||
block::state::BlockState,
|
block::state::BlockState,
|
||||||
coordinates::XZBlockCoordinates,
|
coordinates::XZBlockCoordinates,
|
||||||
generation::{
|
generation::{
|
||||||
|
Seed,
|
||||||
generator::{BiomeGenerator, GeneratorInit, TerrainGenerator},
|
generator::{BiomeGenerator, GeneratorInit, TerrainGenerator},
|
||||||
generic_generator::GenericGenerator,
|
generic_generator::GenericGenerator,
|
||||||
Seed,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
use pumpkin_util::math::{vector2::Vector2, vector3::Vector3};
|
use pumpkin_util::math::{vector2::Vector2, vector3::Vector3};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
WORLD_LOWEST_Y, WORLD_MAX_Y,
|
||||||
chunk::{ChunkData, Subchunks},
|
chunk::{ChunkData, Subchunks},
|
||||||
coordinates::ChunkRelativeBlockCoordinates,
|
coordinates::ChunkRelativeBlockCoordinates,
|
||||||
generation::{
|
generation::{
|
||||||
generator::GeneratorInit, noise_router::proto_noise_router::GlobalProtoNoiseRouter,
|
GlobalRandomConfig, Seed, WorldGenerator, generator::GeneratorInit,
|
||||||
proto_chunk::ProtoChunk, GlobalRandomConfig, Seed, WorldGenerator,
|
noise_router::proto_noise_router::GlobalProtoNoiseRouter, proto_chunk::ProtoChunk,
|
||||||
},
|
},
|
||||||
noise_router::NOISE_ROUTER_ASTS,
|
noise_router::NOISE_ROUTER_ASTS,
|
||||||
WORLD_LOWEST_Y, WORLD_MAX_Y,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct TestGenerator {
|
pub struct TestGenerator {
|
||||||
|
|||||||
@ -21,7 +21,7 @@ use implementation::{
|
|||||||
//overworld::biome::plains::PlainsGenerator,
|
//overworld::biome::plains::PlainsGenerator,
|
||||||
test::TestGenerator,
|
test::TestGenerator,
|
||||||
};
|
};
|
||||||
use pumpkin_util::random::{xoroshiro128::Xoroshiro, RandomDeriver, RandomImpl};
|
use pumpkin_util::random::{RandomDeriver, RandomImpl, xoroshiro128::Xoroshiro};
|
||||||
pub use seed::Seed;
|
pub use seed::Seed;
|
||||||
|
|
||||||
use generator::GeneratorInit;
|
use generator::GeneratorInit;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use num_traits::Pow;
|
|||||||
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
|
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
|
||||||
use pumpkin_util::random::RandomGenerator;
|
use pumpkin_util::random::RandomGenerator;
|
||||||
|
|
||||||
use super::{lerp3, GRADIENTS};
|
use super::{GRADIENTS, lerp3};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct PerlinNoiseSampler {
|
pub struct PerlinNoiseSampler {
|
||||||
@ -357,7 +357,7 @@ mod double_perlin_noise_sampler_test {
|
|||||||
use crate::generation::noise::perlin::DoublePerlinNoiseSampler;
|
use crate::generation::noise::perlin::DoublePerlinNoiseSampler;
|
||||||
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
|
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
|
||||||
use pumpkin_util::random::{
|
use pumpkin_util::random::{
|
||||||
legacy_rand::LegacyRand, xoroshiro128::Xoroshiro, RandomGenerator, RandomImpl,
|
RandomGenerator, RandomImpl, legacy_rand::LegacyRand, xoroshiro128::Xoroshiro,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -560,7 +560,7 @@ mod double_perlin_noise_sampler_test {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod octave_perline_noise_sampler_test {
|
mod octave_perline_noise_sampler_test {
|
||||||
use pumpkin_util::random::{
|
use pumpkin_util::random::{
|
||||||
legacy_rand::LegacyRand, xoroshiro128::Xoroshiro, RandomGenerator, RandomImpl,
|
RandomGenerator, RandomImpl, legacy_rand::LegacyRand, xoroshiro128::Xoroshiro,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::OctavePerlinNoiseSampler;
|
use super::OctavePerlinNoiseSampler;
|
||||||
@ -733,7 +733,7 @@ mod perlin_noise_sampler_test {
|
|||||||
|
|
||||||
use pumpkin_util::{
|
use pumpkin_util::{
|
||||||
assert_eq_delta,
|
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};
|
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!(first, -15);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
amplitudes,
|
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
|
||||||
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
use num_traits::Pow;
|
use num_traits::Pow;
|
||||||
use pumpkin_util::random::{legacy_rand::LegacyRand, RandomImpl};
|
use pumpkin_util::random::{RandomImpl, legacy_rand::LegacyRand};
|
||||||
|
|
||||||
use super::GRADIENTS;
|
use super::GRADIENTS;
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ impl OctaveSimplexNoiseSampler {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod octave_simplex_noise_sampler_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;
|
use crate::generation::noise::simplex::OctaveSimplexNoiseSampler;
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ mod octave_simplex_noise_sampler_test {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod simplex_noise_sampler_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;
|
use crate::generation::noise::simplex::SimplexNoiseSampler;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use pumpkin_util::random::{legacy_rand::LegacyRand, RandomImpl};
|
use pumpkin_util::random::{RandomImpl, legacy_rand::LegacyRand};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
generation::{
|
generation::{
|
||||||
|
|||||||
@ -5,6 +5,7 @@ use std::fs;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::LazyLock;
|
use std::sync::LazyLock;
|
||||||
|
|
||||||
|
use crate::generation::GlobalRandomConfig;
|
||||||
use crate::generation::noise_router::chunk_density_function::{
|
use crate::generation::noise_router::chunk_density_function::{
|
||||||
ChunkNoiseFunctionSampleOptions, SampleAction,
|
ChunkNoiseFunctionSampleOptions, SampleAction,
|
||||||
};
|
};
|
||||||
@ -12,9 +13,8 @@ use crate::generation::noise_router::chunk_noise_router::{
|
|||||||
ChunkNoiseDensityFunction, ChunkNoiseFunctionComponent,
|
ChunkNoiseDensityFunction, ChunkNoiseFunctionComponent,
|
||||||
};
|
};
|
||||||
use crate::generation::noise_router::proto_noise_router::{
|
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::noise_router::NOISE_ROUTER_ASTS;
|
||||||
use crate::read_data_from_file;
|
use crate::read_data_from_file;
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
generation::biome_coords, noise_router::density_function_ast::WrapperType,
|
GlobalProtoNoiseRouter, generation::biome_coords,
|
||||||
GlobalProtoNoiseRouter,
|
noise_router::density_function_ast::WrapperType,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
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"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,24 +7,24 @@ use enum_dispatch::enum_dispatch;
|
|||||||
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
|
use pumpkin_data::chunk::DoublePerlinNoiseParameters;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
GlobalRandomConfig,
|
||||||
generation::noise::perlin::DoublePerlinNoiseSampler,
|
generation::noise::perlin::DoublePerlinNoiseSampler,
|
||||||
noise_router::{
|
noise_router::{
|
||||||
density_function_ast::{DensityFunctionRepr, SplineRepr},
|
density_function_ast::{DensityFunctionRepr, SplineRepr},
|
||||||
noise_router_ast::NoiseRouterRepr,
|
noise_router_ast::NoiseRouterRepr,
|
||||||
},
|
},
|
||||||
GlobalRandomConfig,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
chunk_density_function::ChunkNoiseFunctionSampleOptions,
|
chunk_density_function::ChunkNoiseFunctionSampleOptions,
|
||||||
chunk_noise_router::{ChunkNoiseFunctionComponent, StaticChunkNoiseFunctionComponentImpl},
|
chunk_noise_router::{ChunkNoiseFunctionComponent, StaticChunkNoiseFunctionComponentImpl},
|
||||||
density_function::{
|
density_function::{
|
||||||
|
IndexToNoisePos, NoiseFunctionComponentRange, NoisePos, PassThrough,
|
||||||
|
StaticIndependentChunkNoiseFunctionComponentImpl, Wrapper,
|
||||||
math::{Binary, Clamp, Constant, Linear, Unary},
|
math::{Binary, Clamp, Constant, Linear, Unary},
|
||||||
misc::{ClampedYGradient, EndIsland, RangeChoice, WeirdScaled},
|
misc::{ClampedYGradient, EndIsland, RangeChoice, WeirdScaled},
|
||||||
noise::{InterpolatedNoiseSampler, Noise, ShiftA, ShiftB, ShiftedNoise},
|
noise::{InterpolatedNoiseSampler, Noise, ShiftA, ShiftB, ShiftedNoise},
|
||||||
spline::{Spline, SplineFunction, SplinePoint, SplineValue},
|
spline::{Spline, SplineFunction, SplinePoint, SplineValue},
|
||||||
IndexToNoisePos, NoiseFunctionComponentRange, NoisePos, PassThrough,
|
|
||||||
StaticIndependentChunkNoiseFunctionComponentImpl, Wrapper,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ pub mod block_pos {
|
|||||||
use pumpkin_util::math::vector3::Vector3;
|
use pumpkin_util::math::vector3::Vector3;
|
||||||
|
|
||||||
use super::{
|
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]
|
#[inline]
|
||||||
|
|||||||
@ -8,11 +8,11 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
|
GlobalRandomConfig,
|
||||||
aquifer_sampler::{FluidLevel, FluidLevelSampler, FluidLevelSamplerImpl},
|
aquifer_sampler::{FluidLevel, FluidLevelSampler, FluidLevelSamplerImpl},
|
||||||
chunk_noise::{ChunkNoiseGenerator, LAVA_BLOCK, STONE_BLOCK, WATER_BLOCK},
|
chunk_noise::{ChunkNoiseGenerator, LAVA_BLOCK, STONE_BLOCK, WATER_BLOCK},
|
||||||
noise_router::proto_noise_router::GlobalProtoNoiseRouter,
|
noise_router::proto_noise_router::GlobalProtoNoiseRouter,
|
||||||
positions::chunk_pos::{start_block_x, start_block_z},
|
positions::chunk_pos::{start_block_x, start_block_z},
|
||||||
GlobalRandomConfig,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct StandardChunkFluidLevelSampler {
|
pub struct StandardChunkFluidLevelSampler {
|
||||||
@ -239,13 +239,13 @@ mod test {
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
generation::{
|
generation::{
|
||||||
|
GlobalRandomConfig,
|
||||||
noise_router::{
|
noise_router::{
|
||||||
density_function::{NoiseFunctionComponentRange, PassThrough},
|
density_function::{NoiseFunctionComponentRange, PassThrough},
|
||||||
proto_noise_router::{GlobalProtoNoiseRouter, ProtoNoiseFunctionComponent},
|
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,
|
read_data_from_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)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct Seed(pub u64);
|
pub struct Seed(pub u64);
|
||||||
|
|||||||
@ -2,24 +2,24 @@ use std::{fs, path::PathBuf, sync::Arc};
|
|||||||
|
|
||||||
use dashmap::{DashMap, Entry};
|
use dashmap::{DashMap, Entry};
|
||||||
use num_traits::Zero;
|
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 pumpkin_util::math::vector2::Vector2;
|
||||||
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
||||||
use tokio::{
|
use tokio::{
|
||||||
runtime::Handle,
|
runtime::Handle,
|
||||||
sync::{mpsc, RwLock},
|
sync::{RwLock, mpsc},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
chunk::{
|
chunk::{
|
||||||
anvil::AnvilChunkFormat, linear::LinearChunkFormat, ChunkData, ChunkParsingError,
|
ChunkData, ChunkParsingError, ChunkReader, ChunkReadingError, ChunkWriter,
|
||||||
ChunkReader, ChunkReadingError, ChunkWriter,
|
anvil::AnvilChunkFormat, linear::LinearChunkFormat,
|
||||||
},
|
},
|
||||||
generation::{get_world_gen, Seed, WorldGenerator},
|
generation::{Seed, WorldGenerator, get_world_gen},
|
||||||
lock::{anvil::AnvilLevelLocker, LevelLocker},
|
lock::{LevelLocker, anvil::AnvilLevelLocker},
|
||||||
world_info::{
|
world_info::{
|
||||||
anvil::{AnvilLevelInfo, LEVEL_DAT_BACKUP_FILE_NAME, LEVEL_DAT_FILE_NAME},
|
|
||||||
LevelData, WorldInfoError, WorldInfoReader, WorldInfoWriter,
|
LevelData, WorldInfoError, WorldInfoReader, WorldInfoWriter,
|
||||||
|
anvil::{AnvilLevelInfo, LEVEL_DAT_BACKUP_FILE_NAME, LEVEL_DAT_FILE_NAME},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ macro_rules! read_data_from_file {
|
|||||||
|
|
||||||
// TODO: is there a way to do in-file benches?
|
// TODO: is there a way to do in-file benches?
|
||||||
pub use generation::{
|
pub use generation::{
|
||||||
noise_router::proto_noise_router::GlobalProtoNoiseRouter, GlobalRandomConfig,
|
GlobalRandomConfig, noise_router::proto_noise_router::GlobalProtoNoiseRouter,
|
||||||
};
|
};
|
||||||
pub use noise_router::NOISE_ROUTER_ASTS;
|
pub use noise_router::NOISE_ROUTER_ASTS;
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use std::{
|
|||||||
time::{SystemTime, UNIX_EPOCH},
|
time::{SystemTime, UNIX_EPOCH},
|
||||||
};
|
};
|
||||||
|
|
||||||
use flate2::{read::GzDecoder, write::GzEncoder, Compression};
|
use flate2::{Compression, read::GzDecoder, write::GzEncoder};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -125,7 +125,7 @@ mod test {
|
|||||||
world_info::{DataPacks, LevelData, WorldGenSettings, WorldInfoError, WorldVersion},
|
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]
|
#[test]
|
||||||
fn test_preserve_level_dat_seed() {
|
fn test_preserve_level_dat_seed() {
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
name = "pumpkin"
|
name = "pumpkin"
|
||||||
version = "0.1.0-dev"
|
version = "0.1.0-dev"
|
||||||
description = "Empowering everyone to host fast and efficient Minecraft servers."
|
description = "Empowering everyone to host fast and efficient Minecraft servers."
|
||||||
edition = "2021"
|
edition.workspace = true
|
||||||
rust-version = "1.83"
|
rust-version = "1.85"
|
||||||
|
|
||||||
[package.metadata.tauri-winres]
|
[package.metadata.tauri-winres]
|
||||||
# FileDescription is handled as the Program name by Windows!
|
# FileDescription is handled as the Program name by Windows!
|
||||||
|
|||||||
@ -8,7 +8,7 @@ use pumpkin_inventory::{Chest, OpenContainer};
|
|||||||
use pumpkin_macros::pumpkin_block;
|
use pumpkin_macros::pumpkin_block;
|
||||||
use pumpkin_protocol::{client::play::CBlockAction, codec::var_int::VarInt};
|
use pumpkin_protocol::{client::play::CBlockAction, codec::var_int::VarInt};
|
||||||
use pumpkin_util::math::position::BlockPos;
|
use pumpkin_util::math::position::BlockPos;
|
||||||
use pumpkin_world::block::registry::{get_block, Block};
|
use pumpkin_world::block::registry::{Block, get_block};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
block::{pumpkin_block::PumpkinBlock, registry::BlockActionResult},
|
block::{pumpkin_block::PumpkinBlock, registry::BlockActionResult},
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use pumpkin_data::item::Item;
|
|||||||
use pumpkin_macros::pumpkin_block;
|
use pumpkin_macros::pumpkin_block;
|
||||||
use pumpkin_protocol::server::play::SUseItemOn;
|
use pumpkin_protocol::server::play::SUseItemOn;
|
||||||
use pumpkin_util::math::position::BlockPos;
|
use pumpkin_util::math::position::BlockPos;
|
||||||
use pumpkin_world::block::{registry::Block, BlockDirection};
|
use pumpkin_world::block::{BlockDirection, registry::Block};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
block::{properties::Direction, pumpkin_block::PumpkinBlock, registry::BlockActionResult},
|
block::{properties::Direction, pumpkin_block::PumpkinBlock, registry::BlockActionResult},
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
use blocks::{chest::ChestBlock, furnace::FurnaceBlock, lever::LeverBlock};
|
use blocks::{chest::ChestBlock, furnace::FurnaceBlock, lever::LeverBlock};
|
||||||
use properties::{
|
use properties::{
|
||||||
|
BlockPropertiesManager,
|
||||||
age::Age,
|
age::Age,
|
||||||
attachment::Attachment,
|
attachment::Attachment,
|
||||||
axis::Axis,
|
axis::Axis,
|
||||||
@ -14,7 +15,6 @@ use properties::{
|
|||||||
slab_type::SlabType,
|
slab_type::SlabType,
|
||||||
stair_shape::StairShape,
|
stair_shape::StairShape,
|
||||||
waterlog::Waterlogged,
|
waterlog::Waterlogged,
|
||||||
BlockPropertiesManager,
|
|
||||||
};
|
};
|
||||||
use pumpkin_data::entity::EntityType;
|
use pumpkin_data::entity::EntityType;
|
||||||
use pumpkin_data::item::Item;
|
use pumpkin_data::item::Item;
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use async_trait::async_trait;
|
|||||||
use pumpkin_macros::block_property;
|
use pumpkin_macros::block_property;
|
||||||
use pumpkin_protocol::server::play::SUseItemOn;
|
use pumpkin_protocol::server::play::SUseItemOn;
|
||||||
use pumpkin_util::math::position::BlockPos;
|
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};
|
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use async_trait::async_trait;
|
|||||||
use pumpkin_macros::block_property;
|
use pumpkin_macros::block_property;
|
||||||
use pumpkin_protocol::server::play::SUseItemOn;
|
use pumpkin_protocol::server::play::SUseItemOn;
|
||||||
use pumpkin_util::math::position::BlockPos;
|
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};
|
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use async_trait::async_trait;
|
|||||||
use pumpkin_macros::block_property;
|
use pumpkin_macros::block_property;
|
||||||
use pumpkin_protocol::server::play::SUseItemOn;
|
use pumpkin_protocol::server::play::SUseItemOn;
|
||||||
use pumpkin_util::math::{position::BlockPos, vector3::Vector3};
|
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};
|
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use async_trait::async_trait;
|
|||||||
use pumpkin_macros::block_property;
|
use pumpkin_macros::block_property;
|
||||||
use pumpkin_protocol::server::play::SUseItemOn;
|
use pumpkin_protocol::server::play::SUseItemOn;
|
||||||
use pumpkin_util::math::position::BlockPos;
|
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};
|
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use async_trait::async_trait;
|
|||||||
use pumpkin_macros::block_property;
|
use pumpkin_macros::block_property;
|
||||||
use pumpkin_protocol::server::play::SUseItemOn;
|
use pumpkin_protocol::server::play::SUseItemOn;
|
||||||
use pumpkin_util::math::position::BlockPos;
|
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};
|
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use async_trait::async_trait;
|
|||||||
use pumpkin_macros::block_property;
|
use pumpkin_macros::block_property;
|
||||||
use pumpkin_protocol::server::play::SUseItemOn;
|
use pumpkin_protocol::server::play::SUseItemOn;
|
||||||
use pumpkin_util::math::position::BlockPos;
|
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};
|
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,8 @@ use pumpkin_macros::block_property;
|
|||||||
use pumpkin_protocol::server::play::SUseItemOn;
|
use pumpkin_protocol::server::play::SUseItemOn;
|
||||||
use pumpkin_util::math::position::BlockPos;
|
use pumpkin_util::math::position::BlockPos;
|
||||||
use pumpkin_world::block::{
|
use pumpkin_world::block::{
|
||||||
registry::{Block, State},
|
|
||||||
BlockDirection,
|
BlockDirection,
|
||||||
|
registry::{Block, State},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};
|
use super::{BlockProperties, BlockProperty, BlockPropertyMetadata, Direction};
|
||||||
|
|||||||
@ -5,8 +5,8 @@ use pumpkin_protocol::server::play::SUseItemOn;
|
|||||||
use pumpkin_util::math::position::BlockPos;
|
use pumpkin_util::math::position::BlockPos;
|
||||||
use pumpkin_world::{
|
use pumpkin_world::{
|
||||||
block::{
|
block::{
|
||||||
registry::{Block, State, BLOCKS},
|
|
||||||
BlockDirection,
|
BlockDirection,
|
||||||
|
registry::{BLOCKS, Block, State},
|
||||||
},
|
},
|
||||||
item::ItemStack,
|
item::ItemStack,
|
||||||
};
|
};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user