mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
Moved config into its own crate
This commit is contained in:
11
Cargo.lock
generated
11
Cargo.lock
generated
@@ -1906,6 +1906,7 @@ dependencies = [
|
||||
"num-bigint",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"pumpkin-config",
|
||||
"pumpkin-core",
|
||||
"pumpkin-entity",
|
||||
"pumpkin-inventory",
|
||||
@@ -1929,6 +1930,16 @@ dependencies = [
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pumpkin-config"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"pumpkin-core",
|
||||
"serde",
|
||||
"toml 0.8.19",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pumpkin-core"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = [ "pumpkin-core", "pumpkin-entity", "pumpkin-inventory", "pumpkin-macros/", "pumpkin-plugin", "pumpkin-protocol/", "pumpkin-registry/", "pumpkin-world", "pumpkin/"]
|
||||
members = [ "pumpkin-config", "pumpkin-core", "pumpkin-entity", "pumpkin-inventory", "pumpkin-macros/", "pumpkin-plugin", "pumpkin-protocol/", "pumpkin-registry/", "pumpkin-world", "pumpkin/"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0"
|
||||
|
||||
12
pumpkin-config/Cargo.toml
Normal file
12
pumpkin-config/Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "pumpkin-config"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[dependencies]
|
||||
pumpkin-core = { path = "../pumpkin-core" }
|
||||
|
||||
serde = "1.0"
|
||||
toml = "0.8"
|
||||
|
||||
log.workspace = true
|
||||
@@ -1,7 +1,6 @@
|
||||
use pumpkin_core::ProfileAction;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::client::authentication::ProfileAction;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct AuthenticationConfig {
|
||||
/// Whether to use Mojang authentication.
|
||||
@@ -13,3 +13,10 @@ pub enum Difficulty {
|
||||
Normal,
|
||||
Hard,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
pub enum ProfileAction {
|
||||
ForcedNameChange,
|
||||
UsingBannedSkin,
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ default = []
|
||||
[dependencies]
|
||||
# pumpkin
|
||||
pumpkin-core = { path = "../pumpkin-core"}
|
||||
pumpkin-config = { path = "../pumpkin-config" }
|
||||
pumpkin-plugin = { path = "../pumpkin-plugin"}
|
||||
pumpkin-inventory = { path = "../pumpkin-inventory"}
|
||||
pumpkin-world = { path = "../pumpkin-world"}
|
||||
|
||||
@@ -2,16 +2,15 @@ use std::{collections::HashMap, net::IpAddr};
|
||||
|
||||
use base64::{engine::general_purpose, Engine};
|
||||
use num_bigint::BigInt;
|
||||
use pumpkin_config::{auth::TextureConfig, ADVANCED_CONFIG};
|
||||
use pumpkin_core::ProfileAction;
|
||||
use pumpkin_protocol::Property;
|
||||
use reqwest::{StatusCode, Url};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Deserialize;
|
||||
use thiserror::Error;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{
|
||||
config::{auth::TextureConfig, ADVANCED_CONFIG},
|
||||
server::Server,
|
||||
};
|
||||
use crate::server::Server;
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
#[allow(non_snake_case)]
|
||||
@@ -32,14 +31,6 @@ pub struct Texture {
|
||||
metadata: Option<HashMap<String, String>>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum ProfileAction {
|
||||
#[serde(rename = "FORCED_NAME_CHANGE")]
|
||||
ForcedNameChange,
|
||||
#[serde(rename = "USING_BANNED_SKIN")]
|
||||
UsingBannedSkin,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
pub struct GameProfile {
|
||||
pub id: Uuid,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use num_traits::FromPrimitive;
|
||||
use pumpkin_config::{ADVANCED_CONFIG, BASIC_CONFIG};
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use pumpkin_protocol::{
|
||||
client::{
|
||||
@@ -19,7 +20,6 @@ use sha1::{Digest, Sha1};
|
||||
|
||||
use crate::{
|
||||
client::authentication::{self, GameProfile},
|
||||
config::{ADVANCED_CONFIG, BASIC_CONFIG},
|
||||
entity::player::{ChatMode, Hand},
|
||||
proxy::velocity::velocity_login,
|
||||
server::{Server, CURRENT_MC_VERSION},
|
||||
|
||||
@@ -2,12 +2,12 @@ use std::f32::consts::PI;
|
||||
|
||||
use crate::{
|
||||
commands::{handle_command, CommandSender},
|
||||
config::ADVANCED_CONFIG,
|
||||
entity::player::{ChatMode, Hand, Player},
|
||||
server::Server,
|
||||
util::math::wrap_degrees,
|
||||
};
|
||||
use num_traits::FromPrimitive;
|
||||
use pumpkin_config::ADVANCED_CONFIG;
|
||||
use pumpkin_core::{text::TextComponent, GameMode};
|
||||
use pumpkin_entity::EntityId;
|
||||
use pumpkin_inventory::WindowType;
|
||||
|
||||
@@ -18,7 +18,6 @@ use server::Server;
|
||||
|
||||
pub mod client;
|
||||
pub mod commands;
|
||||
pub mod config;
|
||||
pub mod entity;
|
||||
pub mod proxy;
|
||||
pub mod rcon;
|
||||
@@ -29,8 +28,8 @@ pub mod world;
|
||||
fn main() -> io::Result<()> {
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use config::{ADVANCED_CONFIG, BASIC_CONFIG};
|
||||
use entity::player::Player;
|
||||
use pumpkin_config::{ADVANCED_CONFIG, BASIC_CONFIG};
|
||||
use pumpkin_core::text::{color::NamedColor, TextComponent};
|
||||
use rcon::RCONServer;
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@ use std::net::SocketAddr;
|
||||
|
||||
use bytes::{BufMut, BytesMut};
|
||||
use hmac::{Hmac, Mac};
|
||||
use pumpkin_config::proxy::VelocityConfig;
|
||||
use pumpkin_protocol::{
|
||||
bytebuf::ByteBuffer, client::login::CLoginPluginRequest, server::login::SLoginPluginResponse,
|
||||
};
|
||||
use sha2::Sha256;
|
||||
|
||||
use crate::{client::Client, config::proxy::VelocityConfig};
|
||||
use crate::client::Client;
|
||||
|
||||
type HmacSha256 = Hmac<Sha256>;
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ use mio::{
|
||||
Events, Interest, Poll, Token,
|
||||
};
|
||||
use packet::{Packet, PacketError, PacketType};
|
||||
use pumpkin_config::RCONConfig;
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::{commands::handle_command, config::RCONConfig, server::Server};
|
||||
use crate::{commands::handle_command, server::Server};
|
||||
|
||||
mod packet;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use std::{
|
||||
use base64::{engine::general_purpose, Engine};
|
||||
use image::GenericImageView;
|
||||
use mio::Token;
|
||||
use pumpkin_config::{BasicConfiguration, BASIC_CONFIG};
|
||||
use pumpkin_core::GameMode;
|
||||
use pumpkin_entity::EntityId;
|
||||
use pumpkin_plugin::PluginLoader;
|
||||
@@ -23,12 +24,7 @@ use pumpkin_world::dimension::Dimension;
|
||||
use pumpkin_registry::Registry;
|
||||
use rsa::{traits::PublicKeyParts, RsaPrivateKey, RsaPublicKey};
|
||||
|
||||
use crate::{
|
||||
client::Client,
|
||||
config::{BasicConfiguration, BASIC_CONFIG},
|
||||
entity::player::Player,
|
||||
world::World,
|
||||
};
|
||||
use crate::{client::Client, entity::player::Player, world::World};
|
||||
|
||||
pub const CURRENT_MC_VERSION: &str = "1.21.1";
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use std::{
|
||||
|
||||
use mio::Token;
|
||||
use num_traits::ToPrimitive;
|
||||
use pumpkin_config::BasicConfiguration;
|
||||
use pumpkin_entity::{entity_type::EntityType, EntityId};
|
||||
use pumpkin_protocol::{
|
||||
client::play::{
|
||||
@@ -19,7 +20,7 @@ use pumpkin_protocol::{
|
||||
use pumpkin_world::{level::Level, radial_chunk_iterator::RadialIterator};
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use crate::{config::BasicConfiguration, entity::player::Player};
|
||||
use crate::entity::player::Player;
|
||||
|
||||
pub struct World {
|
||||
pub level: Arc<Mutex<Level>>,
|
||||
|
||||
Reference in New Issue
Block a user