mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
chore: move to crates folder
This commit is contained in:
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
|||||||
[submodule "pumpkin-plugin-wit"]
|
[submodule "pumpkin-plugin-wit"]
|
||||||
path = pumpkin-plugin-wit
|
path = crates/pumpkin-plugin-wit
|
||||||
url = https://github.com/Pumpkin-MC/pumpkin-plugin-wit
|
url = https://github.com/Pumpkin-MC/pumpkin-plugin-wit
|
||||||
|
|||||||
64
Cargo.toml
64
Cargo.toml
@@ -1,19 +1,23 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
members = [
|
members = [
|
||||||
"pumpkin-api-macros",
|
"crates/pumpkin",
|
||||||
"pumpkin-config",
|
"crates/pumpkin-api-macros",
|
||||||
"pumpkin-util",
|
"crates/pumpkin-codecs",
|
||||||
"pumpkin-inventory",
|
"crates/pumpkin-config",
|
||||||
"pumpkin-macros/",
|
"crates/pumpkin-data",
|
||||||
"pumpkin-protocol/",
|
"crates/pumpkin-inventory",
|
||||||
"pumpkin-world",
|
"crates/pumpkin-macros",
|
||||||
"pumpkin/",
|
"crates/pumpkin-nbt",
|
||||||
"pumpkin-data",
|
"crates/pumpkin-plugin-api",
|
||||||
"pumpkin-plugin-api",
|
"crates/pumpkin-protocol",
|
||||||
"pumpkin-codecs"
|
"crates/pumpkin-util",
|
||||||
|
"crates/pumpkin-world",
|
||||||
]
|
]
|
||||||
exclude = ["pumpkin-codegen"]
|
exclude = ["tools/pumpkin-codegen"]
|
||||||
|
|
||||||
|
# [workspace.lints.rust]
|
||||||
|
# missing_docs = "warn"
|
||||||
|
|
||||||
[workspace.lints.clippy]
|
[workspace.lints.clippy]
|
||||||
# Groups
|
# Groups
|
||||||
@@ -49,7 +53,23 @@ print_stderr = "deny"
|
|||||||
todo = "deny"
|
todo = "deny"
|
||||||
unreachable = "deny"
|
unreachable = "deny"
|
||||||
unimplemented = "deny"
|
unimplemented = "deny"
|
||||||
# indexing_slicing = "deny"
|
|
||||||
|
# Safety & Soundness
|
||||||
|
undocumented_unsafe_blocks = "deny"
|
||||||
|
uninit_assumed_init = "deny"
|
||||||
|
uninit_vec = "deny"
|
||||||
|
cast_ptr_alignment = "deny"
|
||||||
|
ptr_as_ptr = "deny"
|
||||||
|
|
||||||
|
# Production Quality & Best Practices
|
||||||
|
fallible_impl_from = "deny"
|
||||||
|
mut_mut = "deny"
|
||||||
|
char_lit_as_u8 = "deny"
|
||||||
|
match_wild_err_arm = "deny"
|
||||||
|
invalid_upcast_comparisons = "deny"
|
||||||
|
|
||||||
|
# Expected/Allowed
|
||||||
|
clone_on_ref_ptr = "allow"
|
||||||
|
|
||||||
# Expected/Allowed
|
# Expected/Allowed
|
||||||
cargo_common_metadata = "allow"
|
cargo_common_metadata = "allow"
|
||||||
@@ -148,15 +168,15 @@ num-traits = { version = "0.2", default-features = false, features = ["std"] }
|
|||||||
p384 = { version = "0.14.0", default-features = false, features = ["std", "arithmetic", "pkcs8", "ecdh"] }
|
p384 = { version = "0.14.0", default-features = false, features = ["std", "arithmetic", "pkcs8", "ecdh"] }
|
||||||
phf = { version = "0.14.0", default-features = false, features = ["std"] }
|
phf = { version = "0.14.0", default-features = false, features = ["std"] }
|
||||||
proc-macro2 = { version = "1.0", default-features = false, features = ["proc-macro"] }
|
proc-macro2 = { version = "1.0", default-features = false, features = ["proc-macro"] }
|
||||||
pumpkin-codecs = { path = "pumpkin-codecs", default-features = false }
|
pumpkin-codecs = { path = "crates/pumpkin-codecs", default-features = false }
|
||||||
pumpkin-config = { path = "pumpkin-config", default-features = false }
|
pumpkin-config = { path = "crates/pumpkin-config", default-features = false }
|
||||||
pumpkin-data = { path = "pumpkin-data", default-features = false }
|
pumpkin-data = { path = "crates/pumpkin-data", default-features = false }
|
||||||
pumpkin-inventory = { path = "pumpkin-inventory", default-features = false }
|
pumpkin-inventory = { path = "crates/pumpkin-inventory", default-features = false }
|
||||||
pumpkin-macros = { path = "pumpkin-macros", default-features = false }
|
pumpkin-macros = { path = "crates/pumpkin-macros", default-features = false }
|
||||||
pumpkin-nbt = { path = "pumpkin-nbt", default-features = false }
|
pumpkin-nbt = { path = "crates/pumpkin-nbt", default-features = false }
|
||||||
pumpkin-protocol = { path = "pumpkin-protocol", default-features = false }
|
pumpkin-protocol = { path = "crates/pumpkin-protocol", default-features = false }
|
||||||
pumpkin-util = { path = "pumpkin-util", default-features = false }
|
pumpkin-util = { path = "crates/pumpkin-util", default-features = false }
|
||||||
pumpkin-world = { path = "pumpkin-world", default-features = false }
|
pumpkin-world = { path = "crates/pumpkin-world", default-features = false }
|
||||||
quote = { version = "1.0", default-features = false, features = ["proc-macro"] }
|
quote = { version = "1.0", default-features = false, features = ["proc-macro"] }
|
||||||
rand = { version = "0.10.2", default-features = false, features = ["std", "std_rng", "thread_rng"] }
|
rand = { version = "0.10.2", default-features = false, features = ["std", "std_rng", "thread_rng"] }
|
||||||
rsa = { version = "=0.10.0-rc.18", default-features = false, features = ["std", "encoding"] }
|
rsa = { version = "=0.10.0-rc.18", default-features = false, features = ["std", "encoding"] }
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
|
|||||||
may consider it more useful to permit linking proprietary applications with
|
may consider it more useful to permit linking proprietary applications with
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
Public License instead of this License. But first, please read
|
Public License instead of this License. But first, please read
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
|
|||||||
@@ -59,19 +59,20 @@ pub fn plugin_impl(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
let input_struct = parse_macro_input!(item as ItemStruct);
|
let input_struct = parse_macro_input!(item as ItemStruct);
|
||||||
let struct_ident = &input_struct.ident;
|
let struct_ident = &input_struct.ident;
|
||||||
|
|
||||||
let methods = PLUGIN_METHODS.lock().unwrap();
|
let methods: Vec<proc_macro2::TokenStream> = {
|
||||||
|
let guard = PLUGIN_METHODS.lock().unwrap();
|
||||||
let methods: Vec<proc_macro2::TokenStream> = methods
|
guard
|
||||||
.values()
|
.values()
|
||||||
.map(|s| {
|
.map(|s| {
|
||||||
s.parse::<proc_macro2::TokenStream>().unwrap_or_else(|e| {
|
s.parse::<proc_macro2::TokenStream>().unwrap_or_else(|e| {
|
||||||
abort!(
|
abort!(
|
||||||
struct_ident,
|
struct_ident,
|
||||||
format!("re-parsing cached method failed: {e}")
|
format!("re-parsing cached method failed: {e}")
|
||||||
)
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
.collect()
|
||||||
.collect();
|
};
|
||||||
|
|
||||||
// Combine the original struct definition with the impl block and plugin() function
|
// Combine the original struct definition with the impl block and plugin() function
|
||||||
let expanded = quote! {
|
let expanded = quote! {
|
||||||
@@ -53,6 +53,7 @@ impl Default for ChunkCompression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Compression algorithm used for chunk data storage.
|
||||||
#[derive(Deserialize, Serialize, Clone, Copy)]
|
#[derive(Deserialize, Serialize, Clone, Copy)]
|
||||||
pub enum Compression {
|
pub enum Compression {
|
||||||
/// `GZip` Compression.
|
/// `GZip` Compression.
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
//! Configuration management and serialization for the Pumpkin Minecraft server.
|
||||||
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
use fun::FunConfig;
|
use fun::FunConfig;
|
||||||
use logging::LoggingConfig;
|
use logging::LoggingConfig;
|
||||||
use pumpkin_util::world_seed::Seed;
|
use pumpkin_util::world_seed::Seed;
|
||||||
@@ -8,12 +11,19 @@ use serde::{Deserialize, Serialize, de::DeserializeOwned};
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::{fs, num::NonZeroU8, path::Path};
|
use std::{fs, num::NonZeroU8, path::Path};
|
||||||
use tracing::{debug, warn};
|
use tracing::{debug, warn};
|
||||||
|
|
||||||
|
/// Fun and experimental configuration options.
|
||||||
pub mod fun;
|
pub mod fun;
|
||||||
|
/// Server logging configuration options.
|
||||||
pub mod logging;
|
pub mod logging;
|
||||||
|
/// Networking and protocol configuration options.
|
||||||
pub mod networking;
|
pub mod networking;
|
||||||
|
/// Plugin management configuration options.
|
||||||
pub mod plugins;
|
pub mod plugins;
|
||||||
|
/// Recipe system configuration options.
|
||||||
pub mod recipe;
|
pub mod recipe;
|
||||||
|
|
||||||
|
/// Resource pack configuration options.
|
||||||
pub mod resource_pack;
|
pub mod resource_pack;
|
||||||
|
|
||||||
pub use chat::ChatConfig;
|
pub use chat::ChatConfig;
|
||||||
@@ -31,15 +41,20 @@ pub use server_links::ServerLinksConfig;
|
|||||||
mod commands;
|
mod commands;
|
||||||
|
|
||||||
mod chat;
|
mod chat;
|
||||||
|
/// Chunk loading and saving configuration options.
|
||||||
pub mod chunk;
|
pub mod chunk;
|
||||||
|
/// Lighting engine configuration options.
|
||||||
pub mod lighting;
|
pub mod lighting;
|
||||||
|
/// Operator permission level configuration options.
|
||||||
pub mod op;
|
pub mod op;
|
||||||
|
|
||||||
mod advancement;
|
mod advancement;
|
||||||
mod player_data;
|
mod player_data;
|
||||||
mod pvp;
|
mod pvp;
|
||||||
mod server_links;
|
mod server_links;
|
||||||
|
/// Whitelist configuration options.
|
||||||
pub mod whitelist;
|
pub mod whitelist;
|
||||||
|
/// World generation and dimension configuration options.
|
||||||
pub mod world;
|
pub mod world;
|
||||||
|
|
||||||
use advancement::AdvancementConfig;
|
use advancement::AdvancementConfig;
|
||||||
@@ -48,11 +63,14 @@ use player_data::PlayerDataConfig;
|
|||||||
use resource_pack::ResourcePackConfig;
|
use resource_pack::ResourcePackConfig;
|
||||||
use world::LevelConfig;
|
use world::LevelConfig;
|
||||||
|
|
||||||
|
/// Root configuration container for Pumpkin server settings.
|
||||||
#[derive(Deserialize, Serialize, Default)]
|
#[derive(Deserialize, Serialize, Default)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct PumpkinConfig {
|
pub struct PumpkinConfig {
|
||||||
|
/// Core basic configuration settings.
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub basic: BasicConfiguration,
|
pub basic: BasicConfiguration,
|
||||||
|
/// Advanced and feature-specific configuration settings.
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub advanced: AdvancedConfiguration,
|
pub advanced: AdvancedConfiguration,
|
||||||
}
|
}
|
||||||
@@ -217,10 +235,12 @@ impl BasicConfiguration {
|
|||||||
PathBuf::from(&self.default_level_name)
|
PathBuf::from(&self.default_level_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Validates basic configuration options.
|
||||||
pub const fn validate(&self) {}
|
pub const fn validate(&self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AdvancedConfiguration {
|
impl AdvancedConfiguration {
|
||||||
|
/// Validates advanced configuration options.
|
||||||
pub const fn validate(&self) {
|
pub const fn validate(&self) {
|
||||||
//self.resource_pack.validate();
|
//self.resource_pack.validate();
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
/// Lighting engine calculation mode.
|
||||||
#[derive(Deserialize, Serialize, Clone, Copy, PartialEq, Eq, Default)]
|
#[derive(Deserialize, Serialize, Clone, Copy, PartialEq, Eq, Default)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
pub enum LightingEngineConfig {
|
pub enum LightingEngineConfig {
|
||||||
|
/// Default Vanilla lighting propagation.
|
||||||
#[default]
|
#[default]
|
||||||
Default,
|
Default,
|
||||||
|
/// Full skylight everywhere (no shadows).
|
||||||
Full,
|
Full,
|
||||||
|
/// Completely dark lighting everywhere (zero light).
|
||||||
Dark,
|
Dark,
|
||||||
}
|
}
|
||||||
@@ -7,13 +7,21 @@ use crate::LANBroadcastConfig;
|
|||||||
use bedrock::BedrockConfig;
|
use bedrock::BedrockConfig;
|
||||||
use java::JavaConfig;
|
use java::JavaConfig;
|
||||||
|
|
||||||
|
/// Authentication configuration.
|
||||||
pub mod auth;
|
pub mod auth;
|
||||||
|
/// Bedrock protocol networking configuration.
|
||||||
pub mod bedrock;
|
pub mod bedrock;
|
||||||
|
/// Packet compression configuration.
|
||||||
pub mod compression;
|
pub mod compression;
|
||||||
|
/// Java protocol networking configuration.
|
||||||
pub mod java;
|
pub mod java;
|
||||||
|
/// LAN broadcast discovery configuration.
|
||||||
pub mod lan_broadcast;
|
pub mod lan_broadcast;
|
||||||
|
/// Reverse proxy and BungeeCord/Velocity configuration.
|
||||||
pub mod proxy;
|
pub mod proxy;
|
||||||
|
/// GS4 Query protocol configuration.
|
||||||
pub mod query;
|
pub mod query;
|
||||||
|
/// RCON remote console configuration.
|
||||||
pub mod rcon;
|
pub mod rcon;
|
||||||
|
|
||||||
/// Configuration for server networking features.
|
/// Configuration for server networking features.
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
/// Plugin system configuration.
|
||||||
#[derive(Deserialize, Serialize, Default)]
|
#[derive(Deserialize, Serialize, Default)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct PluginsConfig {
|
pub struct PluginsConfig {
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
/// Server resource pack configuration for Java and Bedrock clients.
|
||||||
#[derive(Deserialize, Serialize, Default)]
|
#[derive(Deserialize, Serialize, Default)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct ResourcePackConfig {
|
pub struct ResourcePackConfig {
|
||||||
|
/// Java Edition client resource pack configuration.
|
||||||
pub java: JavaResourcePackConfig,
|
pub java: JavaResourcePackConfig,
|
||||||
|
/// Bedrock Edition client resource pack configuration.
|
||||||
pub bedrock: BedrockResourcePackConfig,
|
pub bedrock: BedrockResourcePackConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,6 +31,7 @@ pub struct JavaResourcePackConfig {
|
|||||||
#[derive(Deserialize, Serialize, Default)]
|
#[derive(Deserialize, Serialize, Default)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct BedrockResourcePackConfig {
|
pub struct BedrockResourcePackConfig {
|
||||||
|
/// Whether Bedrock resource packs are enabled.
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
/// If true, players cannot join without accepting packs.
|
/// If true, players cannot join without accepting packs.
|
||||||
pub force: bool,
|
pub force: bool,
|
||||||
@@ -35,22 +39,33 @@ pub struct BedrockResourcePackConfig {
|
|||||||
pub packs: Vec<BedrockPack>,
|
pub packs: Vec<BedrockPack>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Bedrock resource pack manifest configuration entry.
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct BedrockPack {
|
pub struct BedrockPack {
|
||||||
|
/// Unique identifier for the Bedrock pack.
|
||||||
pub uuid: Uuid,
|
pub uuid: Uuid,
|
||||||
|
/// Version string of the Bedrock pack.
|
||||||
pub version: String,
|
pub version: String,
|
||||||
|
/// Size of the pack in bytes.
|
||||||
pub size: u64,
|
pub size: u64,
|
||||||
|
/// Download URL for remote Bedrock packs.
|
||||||
pub download_url: String,
|
pub download_url: String,
|
||||||
|
/// Optional encryption content key for encrypted packs.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub content_key: String,
|
pub content_key: String,
|
||||||
|
/// Optional sub-pack name inside the archive.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub sub_pack_name: String,
|
pub sub_pack_name: String,
|
||||||
|
/// Optional content identifier.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub content_id: String,
|
pub content_id: String,
|
||||||
|
/// Whether the pack contains client scripts.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub has_scripts: bool,
|
pub has_scripts: bool,
|
||||||
|
/// Whether the pack is marked as an addon pack.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub addon_pack: bool,
|
pub addon_pack: bool,
|
||||||
|
/// Whether Ray Tracing / RTX features are enabled for the pack.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub rtx_enabled: bool,
|
pub rtx_enabled: bool,
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@ use crate::{chunk::ChunkConfig, lighting::LightingEngineConfig};
|
|||||||
pub struct LevelConfig {
|
pub struct LevelConfig {
|
||||||
/// Configuration for chunk behaviour and management.
|
/// Configuration for chunk behaviour and management.
|
||||||
pub chunk: ChunkConfig,
|
pub chunk: ChunkConfig,
|
||||||
|
/// Configuration for lighting engine propagation mode.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub lighting: LightingEngineConfig,
|
pub lighting: LightingEngineConfig,
|
||||||
/// Number of ticks between autosave checks. If 0, autosave is disabled.
|
/// Number of ticks between autosave checks. If 0, autosave is disabled.
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user