mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-31 08:22:33 +00:00
Create pumpkin-core, and move pumpkin-text
This commit is contained in:
24
Cargo.lock
generated
24
Cargo.lock
generated
@@ -1203,11 +1203,11 @@ dependencies = [
|
||||
"num-bigint",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"pumpkin-core",
|
||||
"pumpkin-entity",
|
||||
"pumpkin-inventory",
|
||||
"pumpkin-protocol",
|
||||
"pumpkin-registry",
|
||||
"pumpkin-text",
|
||||
"pumpkin-world",
|
||||
"rand",
|
||||
"rayon",
|
||||
@@ -1225,6 +1225,15 @@ dependencies = [
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pumpkin-core"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fastnbt",
|
||||
"serde",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pumpkin-entity"
|
||||
version = "0.1.0"
|
||||
@@ -1264,8 +1273,8 @@ dependencies = [
|
||||
"log",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"pumpkin-core",
|
||||
"pumpkin-macros",
|
||||
"pumpkin-text",
|
||||
"pumpkin-world",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -1280,20 +1289,11 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"fastnbt",
|
||||
"fastsnbt",
|
||||
"pumpkin-core",
|
||||
"pumpkin-protocol",
|
||||
"pumpkin-text",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pumpkin-text"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fastnbt",
|
||||
"serde",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pumpkin-world"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[workspace]
|
||||
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]
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "pumpkin-text"
|
||||
name = "pumpkin-core"
|
||||
version.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 crate::Text;
|
||||
use super::Text;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(tag = "action", content = "contents", rename_all = "snake_case")]
|
||||
@@ -1,6 +1,6 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
use super::{
|
||||
click::ClickEvent,
|
||||
color::{self, Color},
|
||||
hover::HoverEvent,
|
||||
@@ -6,7 +6,7 @@ edition.workspace = true
|
||||
[dependencies]
|
||||
pumpkin-macros = { path = "../pumpkin-macros" }
|
||||
pumpkin-world = { path = "../pumpkin-world" }
|
||||
pumpkin-text = { path = "../pumpkin-text" }
|
||||
pumpkin-core = { path = "../pumpkin-core" }
|
||||
|
||||
bytes = "1.7"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::uuid::UUID;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_text::TextComponent;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::VarInt;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::VarInt;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_text::TextComponent;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::FromPrimitive;
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::{bytebuf::ByteBuffer, uuid::UUID, BitSet, ClientPacket, VarInt};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use pumpkin_macros::packet;
|
||||
use pumpkin_text::TextComponent;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize)]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::VarInt;
|
||||
use pumpkin_world::item::Item;
|
||||
use serde::{
|
||||
de::{self, SeqAccess, Visitor},
|
||||
de::{self, SeqAccess},
|
||||
Deserialize,
|
||||
};
|
||||
|
||||
@@ -21,8 +21,8 @@ impl<'de> Deserialize<'de> for Slot {
|
||||
where
|
||||
D: de::Deserializer<'de>,
|
||||
{
|
||||
struct VarIntVisitor;
|
||||
impl<'de> Visitor<'de> for VarIntVisitor {
|
||||
struct Visitor;
|
||||
impl<'de> de::Visitor<'de> for Visitor {
|
||||
type Value = Slot;
|
||||
|
||||
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 {
|
||||
pub fn to_item(self) -> Option<Item> {
|
||||
let item_id = self.item_id?.0.try_into().unwrap();
|
||||
|
||||
@@ -5,7 +5,7 @@ edition.workspace = true
|
||||
|
||||
[dependencies]
|
||||
pumpkin-protocol = { path = "../pumpkin-protocol"}
|
||||
pumpkin-text = { path = "../pumpkin-text"}
|
||||
pumpkin-core = { path = "../pumpkin-core"}
|
||||
|
||||
# nbt
|
||||
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;
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
|
||||
@@ -13,7 +13,7 @@ dhat-heap = ["dhat"]
|
||||
dhat = { version = "0.3.3", optional = true }
|
||||
|
||||
# pumpkin
|
||||
pumpkin-text = { path = "../pumpkin-text" }
|
||||
pumpkin-core = { path = "../pumpkin-core"}
|
||||
pumpkin-inventory = { path = "../pumpkin-inventory"}
|
||||
pumpkin-world = { path = "../pumpkin-world"}
|
||||
pumpkin-entity = { path = "../pumpkin-entity"}
|
||||
|
||||
@@ -13,7 +13,7 @@ use pumpkin_protocol::{
|
||||
},
|
||||
ConnectionState, KnownPack, CURRENT_MC_PROTOCOL,
|
||||
};
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use rsa::Pkcs1v15Encrypt;
|
||||
use sha1::{Digest, Sha1};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ use pumpkin_protocol::{
|
||||
},
|
||||
ClientPacket, ConnectionState, PacketError, RawPacket, ServerPacket,
|
||||
};
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
|
||||
use std::io::Read;
|
||||
use thiserror::Error;
|
||||
|
||||
@@ -22,7 +22,7 @@ use pumpkin_protocol::{
|
||||
SUseItemOn, Status,
|
||||
},
|
||||
};
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use pumpkin_world::block::BlockFace;
|
||||
use pumpkin_world::global_registry;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use num_traits::FromPrimitive;
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
|
||||
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_builder::argument;
|
||||
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 ALIAS: &str = "?";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::server::CURRENT_MC_VERSION;
|
||||
use pumpkin_core::text::{color::NamedColor, TextComponent};
|
||||
use pumpkin_protocol::CURRENT_MC_PROTOCOL;
|
||||
use pumpkin_text::{color::NamedColor, TextComponent};
|
||||
|
||||
use crate::commands::tree::CommandTree;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use pumpkin_text::TextComponent;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use std::collections::HashMap;
|
||||
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) {
|
||||
sender.send_message(
|
||||
TextComponent::text(&err).color_named(pumpkin_text::color::NamedColor::Red),
|
||||
TextComponent::text(&err).color_named(pumpkin_core::text::color::NamedColor::Red),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user