Create pumpkin-core, and move pumpkin-text
This commit is contained in:
parent
5d023e696c
commit
8eb894ef13
24
Cargo.lock
generated
24
Cargo.lock
generated
@ -1203,11 +1203,11 @@ dependencies = [
|
|||||||
"num-bigint",
|
"num-bigint",
|
||||||
"num-derive",
|
"num-derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
"pumpkin-core",
|
||||||
"pumpkin-entity",
|
"pumpkin-entity",
|
||||||
"pumpkin-inventory",
|
"pumpkin-inventory",
|
||||||
"pumpkin-protocol",
|
"pumpkin-protocol",
|
||||||
"pumpkin-registry",
|
"pumpkin-registry",
|
||||||
"pumpkin-text",
|
|
||||||
"pumpkin-world",
|
"pumpkin-world",
|
||||||
"rand",
|
"rand",
|
||||||
"rayon",
|
"rayon",
|
||||||
@ -1225,6 +1225,15 @@ dependencies = [
|
|||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pumpkin-core"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"fastnbt",
|
||||||
|
"serde",
|
||||||
|
"uuid",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pumpkin-entity"
|
name = "pumpkin-entity"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -1264,8 +1273,8 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"num-derive",
|
"num-derive",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
"pumpkin-core",
|
||||||
"pumpkin-macros",
|
"pumpkin-macros",
|
||||||
"pumpkin-text",
|
|
||||||
"pumpkin-world",
|
"pumpkin-world",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@ -1280,20 +1289,11 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"fastnbt",
|
"fastnbt",
|
||||||
"fastsnbt",
|
"fastsnbt",
|
||||||
|
"pumpkin-core",
|
||||||
"pumpkin-protocol",
|
"pumpkin-protocol",
|
||||||
"pumpkin-text",
|
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pumpkin-text"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"fastnbt",
|
|
||||||
"serde",
|
|
||||||
"uuid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pumpkin-world"
|
name = "pumpkin-world"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
members = [ "pumpkin-entity", "pumpkin-inventory", "pumpkin-macros/", "pumpkin-protocol/", "pumpkin-registry/", "pumpkin-world", "pumpkin/" ]
|
members = [ "pumpkin-core", "pumpkin-entity", "pumpkin-inventory", "pumpkin-macros/", "pumpkin-protocol/", "pumpkin-registry/", "pumpkin-world", "pumpkin/"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "pumpkin-text"
|
name = "pumpkin-core"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|
||||||
1
pumpkin-core/src/lib.rs
Normal file
1
pumpkin-core/src/lib.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub mod text;
|
||||||
@ -2,7 +2,7 @@ use std::borrow::Cow;
|
|||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::Text;
|
use super::Text;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[serde(tag = "action", content = "contents", rename_all = "snake_case")]
|
#[serde(tag = "action", content = "contents", rename_all = "snake_case")]
|
||||||
@ -1,6 +1,6 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{
|
use super::{
|
||||||
click::ClickEvent,
|
click::ClickEvent,
|
||||||
color::{self, Color},
|
color::{self, Color},
|
||||||
hover::HoverEvent,
|
hover::HoverEvent,
|
||||||
@ -6,7 +6,7 @@ edition.workspace = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
pumpkin-macros = { path = "../pumpkin-macros" }
|
pumpkin-macros = { path = "../pumpkin-macros" }
|
||||||
pumpkin-world = { path = "../pumpkin-world" }
|
pumpkin-world = { path = "../pumpkin-world" }
|
||||||
pumpkin-text = { path = "../pumpkin-text" }
|
pumpkin-core = { path = "../pumpkin-core" }
|
||||||
|
|
||||||
bytes = "1.7"
|
bytes = "1.7"
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use pumpkin_macros::packet;
|
use pumpkin_macros::packet;
|
||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::uuid::UUID;
|
use crate::uuid::UUID;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
use pumpkin_core::text::TextComponent;
|
||||||
use pumpkin_macros::packet;
|
use pumpkin_macros::packet;
|
||||||
use pumpkin_text::TextComponent;
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use pumpkin_macros::packet;
|
use pumpkin_macros::packet;
|
||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::VarInt;
|
use crate::VarInt;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use pumpkin_macros::packet;
|
use pumpkin_macros::packet;
|
||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::VarInt;
|
use crate::VarInt;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
use pumpkin_core::text::TextComponent;
|
||||||
use pumpkin_macros::packet;
|
use pumpkin_macros::packet;
|
||||||
use pumpkin_text::TextComponent;
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use num_derive::{FromPrimitive, ToPrimitive};
|
use num_derive::{FromPrimitive, ToPrimitive};
|
||||||
use num_traits::FromPrimitive;
|
use num_traits::FromPrimitive;
|
||||||
use pumpkin_macros::packet;
|
use pumpkin_macros::packet;
|
||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::{bytebuf::ByteBuffer, uuid::UUID, BitSet, ClientPacket, VarInt};
|
use crate::{bytebuf::ByteBuffer, uuid::UUID, BitSet, ClientPacket, VarInt};
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use pumpkin_macros::packet;
|
use pumpkin_macros::packet;
|
||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use pumpkin_macros::packet;
|
use pumpkin_macros::packet;
|
||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
use pumpkin_core::text::TextComponent;
|
||||||
use pumpkin_macros::packet;
|
use pumpkin_macros::packet;
|
||||||
use pumpkin_text::TextComponent;
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use crate::VarInt;
|
use crate::VarInt;
|
||||||
use pumpkin_world::item::Item;
|
use pumpkin_world::item::Item;
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{self, SeqAccess, Visitor},
|
de::{self, SeqAccess},
|
||||||
Deserialize,
|
Deserialize,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -21,8 +21,8 @@ impl<'de> Deserialize<'de> for Slot {
|
|||||||
where
|
where
|
||||||
D: de::Deserializer<'de>,
|
D: de::Deserializer<'de>,
|
||||||
{
|
{
|
||||||
struct VarIntVisitor;
|
struct Visitor;
|
||||||
impl<'de> Visitor<'de> for VarIntVisitor {
|
impl<'de> de::Visitor<'de> for Visitor {
|
||||||
type Value = Slot;
|
type Value = Slot;
|
||||||
|
|
||||||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
@ -72,9 +72,10 @@ impl<'de> Deserialize<'de> for Slot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deserializer.deserialize_seq(VarIntVisitor)
|
deserializer.deserialize_seq(Visitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Slot {
|
impl Slot {
|
||||||
pub fn to_item(self) -> Option<Item> {
|
pub fn to_item(self) -> Option<Item> {
|
||||||
let item_id = self.item_id?.0.try_into().unwrap();
|
let item_id = self.item_id?.0.try_into().unwrap();
|
||||||
|
|||||||
@ -5,7 +5,7 @@ edition.workspace = true
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
pumpkin-protocol = { path = "../pumpkin-protocol"}
|
pumpkin-protocol = { path = "../pumpkin-protocol"}
|
||||||
pumpkin-text = { path = "../pumpkin-text"}
|
pumpkin-core = { path = "../pumpkin-core"}
|
||||||
|
|
||||||
# nbt
|
# nbt
|
||||||
fastnbt = { git = "https://github.com/owengage/fastnbt.git" }
|
fastnbt = { git = "https://github.com/owengage/fastnbt.git" }
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use pumpkin_text::style::Style;
|
use pumpkin_core::text::style::Style;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
|||||||
@ -13,7 +13,7 @@ dhat-heap = ["dhat"]
|
|||||||
dhat = { version = "0.3.3", optional = true }
|
dhat = { version = "0.3.3", optional = true }
|
||||||
|
|
||||||
# pumpkin
|
# pumpkin
|
||||||
pumpkin-text = { path = "../pumpkin-text" }
|
pumpkin-core = { path = "../pumpkin-core"}
|
||||||
pumpkin-inventory = { path = "../pumpkin-inventory"}
|
pumpkin-inventory = { path = "../pumpkin-inventory"}
|
||||||
pumpkin-world = { path = "../pumpkin-world"}
|
pumpkin-world = { path = "../pumpkin-world"}
|
||||||
pumpkin-entity = { path = "../pumpkin-entity"}
|
pumpkin-entity = { path = "../pumpkin-entity"}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ use pumpkin_protocol::{
|
|||||||
},
|
},
|
||||||
ConnectionState, KnownPack, CURRENT_MC_PROTOCOL,
|
ConnectionState, KnownPack, CURRENT_MC_PROTOCOL,
|
||||||
};
|
};
|
||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use rsa::Pkcs1v15Encrypt;
|
use rsa::Pkcs1v15Encrypt;
|
||||||
use sha1::{Digest, Sha1};
|
use sha1::{Digest, Sha1};
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ use pumpkin_protocol::{
|
|||||||
},
|
},
|
||||||
ClientPacket, ConnectionState, PacketError, RawPacket, ServerPacket,
|
ClientPacket, ConnectionState, PacketError, RawPacket, ServerPacket,
|
||||||
};
|
};
|
||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
|
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|||||||
@ -22,7 +22,7 @@ use pumpkin_protocol::{
|
|||||||
SUseItemOn, Status,
|
SUseItemOn, Status,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use pumpkin_world::block::BlockFace;
|
use pumpkin_world::block::BlockFace;
|
||||||
use pumpkin_world::global_registry;
|
use pumpkin_world::global_registry;
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use num_traits::FromPrimitive;
|
use num_traits::FromPrimitive;
|
||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
|
|
||||||
use crate::commands::arg_player::{consume_arg_player, parse_arg_player};
|
use crate::commands::arg_player::{consume_arg_player, parse_arg_player};
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use crate::commands::dispatcher::{CommandDispatcher, InvalidTreeError};
|
|||||||
use crate::commands::tree::{CommandTree, ConsumedArgs, RawArgs};
|
use crate::commands::tree::{CommandTree, ConsumedArgs, RawArgs};
|
||||||
use crate::commands::tree_builder::argument;
|
use crate::commands::tree_builder::argument;
|
||||||
use crate::commands::{dispatcher_init, CommandSender, DISPATCHER};
|
use crate::commands::{dispatcher_init, CommandSender, DISPATCHER};
|
||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
|
|
||||||
pub(crate) const NAME: &str = "help";
|
pub(crate) const NAME: &str = "help";
|
||||||
pub(crate) const ALIAS: &str = "?";
|
pub(crate) const ALIAS: &str = "?";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use crate::server::CURRENT_MC_VERSION;
|
use crate::server::CURRENT_MC_VERSION;
|
||||||
|
use pumpkin_core::text::{color::NamedColor, TextComponent};
|
||||||
use pumpkin_protocol::CURRENT_MC_PROTOCOL;
|
use pumpkin_protocol::CURRENT_MC_PROTOCOL;
|
||||||
use pumpkin_text::{color::NamedColor, TextComponent};
|
|
||||||
|
|
||||||
use crate::commands::tree::CommandTree;
|
use crate::commands::tree::CommandTree;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use pumpkin_text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ pub fn handle_command(sender: &mut CommandSender, cmd: &str) {
|
|||||||
|
|
||||||
if let Err(err) = dispatcher.dispatch(sender, cmd) {
|
if let Err(err) = dispatcher.dispatch(sender, cmd) {
|
||||||
sender.send_message(
|
sender.send_message(
|
||||||
TextComponent::text(&err).color_named(pumpkin_text::color::NamedColor::Red),
|
TextComponent::text(&err).color_named(pumpkin_core::text::color::NamedColor::Red),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user