mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
fix some typos
- also moved tempfile dep to dev-dependencies - removed the noise crate - renamed some things
This commit is contained in:
@@ -959,7 +959,7 @@ pub(crate) fn build() -> TokenStream {
|
||||
property_enum: renamed_property.clone(),
|
||||
});
|
||||
|
||||
// If this property doesnt have an `enum` yet, make one.
|
||||
// If this property doesn't have an `enum` yet, make one.
|
||||
let _ = property_enums
|
||||
.entry(renamed_property.clone())
|
||||
.or_insert_with(|| PropertyStruct {
|
||||
|
||||
@@ -920,7 +920,7 @@ impl NoiseRouterRepr {
|
||||
.vein_gap
|
||||
.get_index_for_component(&mut noise_component_stack, &mut noise_lookup_map);
|
||||
|
||||
// These should all be cached so it doesnt matter where their components are
|
||||
// These should all be cached so it doesn't matter where their components are
|
||||
let noise_erosion = self
|
||||
.erosion
|
||||
.clone()
|
||||
|
||||
@@ -250,15 +250,14 @@ impl<'a> Container for OptionallyCombinedContainer<'a, 'a> {
|
||||
}
|
||||
|
||||
fn all_slots(&mut self) -> Box<[&mut Option<ItemStack>]> {
|
||||
let slots = match &mut self.container {
|
||||
match &mut self.container {
|
||||
Some(container) => {
|
||||
let mut slots = container.all_slots().into_vec();
|
||||
slots.extend(self.inventory.all_combinable_slots_mut());
|
||||
slots.into_boxed_slice()
|
||||
}
|
||||
None => self.inventory.all_slots(),
|
||||
};
|
||||
slots
|
||||
}
|
||||
}
|
||||
|
||||
fn all_slots_ref(&self) -> Box<[Option<&ItemStack>]> {
|
||||
|
||||
@@ -136,20 +136,20 @@ impl Container for CraftingTable {
|
||||
}
|
||||
fn all_slots(&mut self) -> Box<[&mut Option<ItemStack>]> {
|
||||
let slots = vec![&mut self.output];
|
||||
let slots = slots
|
||||
|
||||
slots
|
||||
.into_iter()
|
||||
.chain(self.input.iter_mut().flatten())
|
||||
.collect();
|
||||
slots
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn all_slots_ref(&self) -> Box<[Option<&ItemStack>]> {
|
||||
let slots = vec![self.output.as_ref()];
|
||||
let slots = slots
|
||||
|
||||
slots
|
||||
.into_iter()
|
||||
.chain(self.input.iter().flatten().map(|i| i.as_ref()))
|
||||
.collect();
|
||||
slots
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn all_combinable_slots(&self) -> Box<[Option<&ItemStack>]> {
|
||||
|
||||
@@ -7,7 +7,9 @@ edition.workspace = true
|
||||
serde.workspace = true
|
||||
thiserror.workspace = true
|
||||
bytes.workspace = true
|
||||
tempfile.workspace = true
|
||||
|
||||
cesu8 = "1.1"
|
||||
flate2 = "1.1"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile.workspace = true
|
||||
|
||||
@@ -41,7 +41,7 @@ impl ClientPacket for CChunkData<'_> {
|
||||
write.write_i64_be(*mb)?;
|
||||
}
|
||||
|
||||
let mut data_buf = Vec::new();
|
||||
let mut blocks_and_biomes_buf = Vec::new();
|
||||
|
||||
let mut sky_light_buf = Vec::new();
|
||||
let mut sky_light_empty_mask = 0;
|
||||
@@ -79,50 +79,52 @@ impl ClientPacket for CChunkData<'_> {
|
||||
|
||||
// Block count
|
||||
let non_empty_block_count = section.block_states.non_air_block_count() as i16;
|
||||
data_buf.write_i16_be(non_empty_block_count)?;
|
||||
blocks_and_biomes_buf.write_i16_be(non_empty_block_count)?;
|
||||
|
||||
// This is a bit messy, but we dont have access to VarInt in pumpkin-world
|
||||
let network_repr = section.block_states.convert_network();
|
||||
data_buf.write_u8_be(network_repr.bits_per_entry)?;
|
||||
blocks_and_biomes_buf.write_u8_be(network_repr.bits_per_entry)?;
|
||||
match network_repr.palette {
|
||||
NetworkPalette::Single(registry_id) => {
|
||||
data_buf.write_var_int(®istry_id.into())?;
|
||||
blocks_and_biomes_buf.write_var_int(®istry_id.into())?;
|
||||
}
|
||||
NetworkPalette::Indirect(palette) => {
|
||||
data_buf.write_var_int(&palette.len().try_into().map_err(|_| {
|
||||
WritingError::Message(format!(
|
||||
"{} is not representable as a VarInt!",
|
||||
palette.len()
|
||||
))
|
||||
})?)?;
|
||||
blocks_and_biomes_buf.write_var_int(&palette.len().try_into().map_err(
|
||||
|_| {
|
||||
WritingError::Message(format!(
|
||||
"{} is not representable as a VarInt!",
|
||||
palette.len()
|
||||
))
|
||||
},
|
||||
)?)?;
|
||||
for registry_id in palette {
|
||||
data_buf.write_var_int(®istry_id.into())?;
|
||||
blocks_and_biomes_buf.write_var_int(®istry_id.into())?;
|
||||
}
|
||||
}
|
||||
NetworkPalette::Direct => {}
|
||||
}
|
||||
|
||||
// NOTE: Not updated in wiki; i64 array length is now determined by the bits per entry
|
||||
//data_buf.write_var_int(&network_repr.packed_data.len().into())?;
|
||||
for packed in network_repr.packed_data {
|
||||
data_buf.write_i64_be(packed)?;
|
||||
blocks_and_biomes_buf.write_i64_be(packed)?;
|
||||
}
|
||||
|
||||
let network_repr = section.biomes.convert_network();
|
||||
data_buf.write_u8_be(network_repr.bits_per_entry)?;
|
||||
blocks_and_biomes_buf.write_u8_be(network_repr.bits_per_entry)?;
|
||||
match network_repr.palette {
|
||||
NetworkPalette::Single(registry_id) => {
|
||||
data_buf.write_var_int(®istry_id.into())?;
|
||||
blocks_and_biomes_buf.write_var_int(®istry_id.into())?;
|
||||
}
|
||||
NetworkPalette::Indirect(palette) => {
|
||||
data_buf.write_var_int(&palette.len().try_into().map_err(|_| {
|
||||
WritingError::Message(format!(
|
||||
"{} is not representable as a VarInt!",
|
||||
palette.len()
|
||||
))
|
||||
})?)?;
|
||||
blocks_and_biomes_buf.write_var_int(&palette.len().try_into().map_err(
|
||||
|_| {
|
||||
WritingError::Message(format!(
|
||||
"{} is not representable as a VarInt!",
|
||||
palette.len()
|
||||
))
|
||||
},
|
||||
)?)?;
|
||||
for registry_id in palette {
|
||||
data_buf.write_var_int(®istry_id.into())?;
|
||||
blocks_and_biomes_buf.write_var_int(®istry_id.into())?;
|
||||
}
|
||||
}
|
||||
NetworkPalette::Direct => {}
|
||||
@@ -131,18 +133,18 @@ impl ClientPacket for CChunkData<'_> {
|
||||
// NOTE: Not updated in wiki; i64 array length is now determined by the bits per entry
|
||||
//data_buf.write_var_int(&network_repr.packed_data.len().into())?;
|
||||
for packed in network_repr.packed_data {
|
||||
data_buf.write_i64_be(packed)?;
|
||||
blocks_and_biomes_buf.write_i64_be(packed)?;
|
||||
}
|
||||
}
|
||||
|
||||
// Chunk data
|
||||
write.write_var_int(&data_buf.len().try_into().map_err(|_| {
|
||||
write.write_var_int(&blocks_and_biomes_buf.len().try_into().map_err(|_| {
|
||||
WritingError::Message(format!(
|
||||
"{} is not representable as a VarInt!",
|
||||
data_buf.len()
|
||||
blocks_and_biomes_buf.len()
|
||||
))
|
||||
})?)?;
|
||||
write.write_slice(&data_buf)?;
|
||||
write.write_slice(&blocks_and_biomes_buf)?;
|
||||
|
||||
// TODO: block entities
|
||||
write.write_var_int(&VarInt(0))?;
|
||||
|
||||
@@ -205,9 +205,7 @@ impl<'de, R: Read> de::Deserializer<'de> for &mut Deserializer<R> {
|
||||
}
|
||||
}
|
||||
|
||||
let value = visitor.visit_seq(Access { deserializer: self });
|
||||
|
||||
value
|
||||
visitor.visit_seq(Access { deserializer: self })
|
||||
}
|
||||
|
||||
fn deserialize_tuple<V>(self, len: usize, visitor: V) -> Result<V::Value, Self::Error>
|
||||
@@ -236,12 +234,10 @@ impl<'de, R: Read> de::Deserializer<'de> for &mut Deserializer<R> {
|
||||
}
|
||||
}
|
||||
|
||||
let value = visitor.visit_seq(Access {
|
||||
visitor.visit_seq(Access {
|
||||
deserializer: self,
|
||||
len,
|
||||
});
|
||||
|
||||
value
|
||||
})
|
||||
}
|
||||
|
||||
fn deserialize_tuple_struct<V>(
|
||||
|
||||
@@ -19,7 +19,6 @@ bytes.workspace = true
|
||||
|
||||
tokio.workspace = true
|
||||
rayon.workspace = true
|
||||
derive_more.workspace = true
|
||||
uuid.workspace = true
|
||||
thiserror.workspace = true
|
||||
serde.workspace = true
|
||||
@@ -42,7 +41,6 @@ itertools = "0.14.0"
|
||||
file-guard = "0.2"
|
||||
indexmap = "2.9"
|
||||
enum_dispatch = "0.3"
|
||||
noise = "0.9"
|
||||
derive-getters = "0.5.0"
|
||||
|
||||
thread_local = "1.1.8"
|
||||
|
||||
@@ -108,7 +108,7 @@ fn initialize_level(
|
||||
/*
|
||||
// This doesn't really test anything...
|
||||
fn bench_chunk_io_parallel(c: &mut Criterion) {
|
||||
// System temp dirs are in-memory, so we cant use temp_dir
|
||||
// System temp dirs are in-memory, so we can't use temp_dir
|
||||
let root_dir = global_path!("./bench_root_tmp");
|
||||
let _ = fs::remove_dir_all(&root_dir); // delete if it exists
|
||||
fs::create_dir(&root_dir).unwrap(); // create the directory
|
||||
|
||||
@@ -326,7 +326,7 @@ impl AnvilChunkData {
|
||||
let compression = compression
|
||||
.unwrap_or_else(|| advanced_config().chunk.compression.algorithm.clone().into());
|
||||
|
||||
// We need to buffer here anyway so theres no use in making an impl Write for this
|
||||
// We need to buffer here anyway so there's no use in making an impl Write for this
|
||||
let compressed_data = compression
|
||||
.compress_data(&raw_bytes, advanced_config().chunk.compression.level)
|
||||
.map_err(ChunkWritingError::Compression)?;
|
||||
@@ -675,7 +675,7 @@ impl ChunkSerializer for AnvilChunkFile {
|
||||
});
|
||||
write_action.maybe_update_chunk_index(index);
|
||||
} else {
|
||||
// Walk back the end of the list; seeing if theres something that can fit
|
||||
// Walk back the end of the list; seeing if there's something that can fit
|
||||
// in our spot. Here we play a game between is it worth it to do all
|
||||
// this swapping. I figure if we don't find it after 64 chunks, just
|
||||
// re-write the whole file instead
|
||||
@@ -772,7 +772,7 @@ impl ChunkSerializer for AnvilChunkFile {
|
||||
}
|
||||
|
||||
// If the shift is negative then there will be trailing data, but i
|
||||
// think thats fine
|
||||
// think that's fine
|
||||
|
||||
let new_end = self.end_sector as i64 + offset;
|
||||
self.end_sector = new_end as u32;
|
||||
|
||||
@@ -413,7 +413,7 @@ impl Cache2D {
|
||||
pub fn new(input_index: usize, min_value: f64, max_value: f64) -> Self {
|
||||
Self {
|
||||
input_index,
|
||||
// I know this is because theres is definitely world coords that are this marker, but this
|
||||
// I know this is because there's is definitely world coords that are this marker, but this
|
||||
// is how vanilla does it, so I'm going to for pairity
|
||||
last_sample_column: chunk_pos::MARKER,
|
||||
last_sample_result: Default::default(),
|
||||
|
||||
@@ -57,7 +57,7 @@ impl ItemStack {
|
||||
if let Some(blocks) =
|
||||
get_tag_values(RegistryKey::Block, entry.strip_prefix('#').unwrap())
|
||||
{
|
||||
if blocks.iter().any(|s| *s == block) {
|
||||
if blocks.contains(&block) {
|
||||
return speed;
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ impl ItemStack {
|
||||
if let Some(blocks) =
|
||||
get_tag_values(RegistryKey::Block, entry.strip_prefix('#').unwrap())
|
||||
{
|
||||
if blocks.iter().any(|s| *s == block) {
|
||||
if blocks.contains(&block) {
|
||||
return correct_for_drops;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,6 @@ async-trait.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
tempfile.workspace = true
|
||||
|
||||
bytes.workspace = true
|
||||
|
||||
rand = "0.8"
|
||||
@@ -94,6 +92,10 @@ dhat = { version = "0.3.3", optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
git-version = "0.3"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile.workspace = true
|
||||
|
||||
# This makes it so the entire project doesn't recompile on each build on linux.
|
||||
[target.'cfg(target_os = "windows")'.build-dependencies]
|
||||
tauri-winres = "0.3"
|
||||
|
||||
@@ -4,6 +4,7 @@ use async_trait::async_trait;
|
||||
use pumpkin_data::block::{
|
||||
Block, BlockProperties, CactusLikeProperties, EnumVariants, Integer0To15,
|
||||
};
|
||||
use pumpkin_data::tag::Tagable;
|
||||
use pumpkin_macros::pumpkin_block;
|
||||
use pumpkin_world::block::BlockDirection;
|
||||
use pumpkin_world::chunk::TickPriority;
|
||||
@@ -85,7 +86,7 @@ impl PumpkinBlock for CactusBlock {
|
||||
}
|
||||
let block = world.get_block(&pos.down()).await.unwrap();
|
||||
// TODO: use tags
|
||||
(block == Block::CACTUS || block == Block::SAND)
|
||||
(block == Block::CACTUS || block.is_tagged_with("minecraft:sand").unwrap())
|
||||
&& !world.get_block_state(&pos.up()).await.unwrap().is_liquid
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ use async_trait::async_trait;
|
||||
use pumpkin_data::block::{
|
||||
Block, BlockProperties, CactusLikeProperties, EnumVariants, Integer0To15,
|
||||
};
|
||||
use pumpkin_data::tag::Tagable;
|
||||
use pumpkin_macros::pumpkin_block;
|
||||
use pumpkin_world::block::BlockDirection;
|
||||
use pumpkin_world::chunk::TickPriority;
|
||||
@@ -78,8 +79,9 @@ impl PumpkinBlock for SugarCaneBlock {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: use tags
|
||||
if block == Block::DIRT || block == Block::SAND {
|
||||
if block.is_tagged_with("minecraft:dirt").unwrap()
|
||||
|| block.is_tagged_with("minecraft:sand").unwrap()
|
||||
{
|
||||
for direction in BlockDirection::horizontal() {
|
||||
let block = world
|
||||
.get_block(&pos.down().offset(direction.to_offset()))
|
||||
|
||||
@@ -14,7 +14,7 @@ use super::{Arg, DefaultNameArgConsumer, FindArg, GetClientSideArgParser};
|
||||
|
||||
/// x and z coordinates only
|
||||
///
|
||||
/// todo: implememnt ~ ^ notations
|
||||
/// todo: implement ~ ^ notations
|
||||
pub struct Position2DArgumentConsumer;
|
||||
|
||||
impl GetClientSideArgParser for Position2DArgumentConsumer {
|
||||
|
||||
@@ -127,7 +127,7 @@ impl NonLeafNodeBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/// Matches a sting literal.
|
||||
/// Matches a string literal.
|
||||
#[must_use]
|
||||
pub fn literal(string: impl Into<String>) -> NonLeafNodeBuilder {
|
||||
NonLeafNodeBuilder {
|
||||
|
||||
@@ -493,7 +493,7 @@ impl Player {
|
||||
offset: Vector3<f32>,
|
||||
max_speed: f32,
|
||||
particle_count: i32,
|
||||
pariticle: Particle,
|
||||
particle: Particle,
|
||||
) {
|
||||
self.client
|
||||
.enqueue_packet(&CParticle::new(
|
||||
@@ -503,7 +503,7 @@ impl Player {
|
||||
offset,
|
||||
max_speed,
|
||||
particle_count,
|
||||
VarInt(pariticle as i32),
|
||||
VarInt(particle as i32),
|
||||
&[],
|
||||
))
|
||||
.await;
|
||||
|
||||
@@ -287,7 +287,7 @@ impl PumpkinServer {
|
||||
} else {
|
||||
format!("{client_addr}")
|
||||
};
|
||||
log::info!(
|
||||
log::debug!(
|
||||
"Accepted connection from: {} (id {})",
|
||||
formatted_address,
|
||||
id
|
||||
|
||||
@@ -31,17 +31,15 @@ pub struct Texture {
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct JsonPublicKey {
|
||||
#[serde(rename = "publicKey")]
|
||||
pub public_key: String,
|
||||
}
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct MojangPublicKeys {
|
||||
#[serde(rename = "profilePropertyKeys")]
|
||||
pub profile_property_keys: Vec<JsonPublicKey>,
|
||||
#[serde(rename = "playerCertificateKeys")]
|
||||
pub player_certificate_keys: Vec<JsonPublicKey>,
|
||||
#[serde(rename = "authenticationKeys")]
|
||||
pub authentication_keys: Option<Vec<JsonPublicKey>>,
|
||||
}
|
||||
|
||||
|
||||
@@ -600,8 +600,7 @@ impl Player {
|
||||
// TODO: Figure out better way to get only the players from player_ids
|
||||
// Also refactor out a better method to get individual advanced state ids
|
||||
|
||||
let players = self
|
||||
.living_entity
|
||||
self.living_entity
|
||||
.entity
|
||||
.world
|
||||
.read()
|
||||
@@ -618,8 +617,7 @@ impl Player {
|
||||
player_ids.contains(&entity_id).then(|| player.clone())
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
players
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub async fn send_container_changes(
|
||||
|
||||
@@ -621,7 +621,7 @@ impl Client {
|
||||
pub async fn kick(&self, reason: TextComponent) {
|
||||
match self.connection_state.load() {
|
||||
ConnectionState::Login => {
|
||||
// TextComponent implements Serialze and writes in bytes instead of String, thats the reasib we only use content
|
||||
// TextComponent implements Serialize and writes in bytes instead of String, that's the reasib we only use content
|
||||
self.send_packet_now(&CLoginDisconnect::new(
|
||||
&serde_json::to_string(&reason.0).unwrap_or_else(|_| String::new()),
|
||||
))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// Proxy implementation for Velocity <https://papermc.io/software/velocity> by `PaperMC`
|
||||
/// Sadly, `PaperMC` does not care about 3rd parties providing support for Velocity. There is no documentation.
|
||||
/// I had to understand the code logic by looking at `PaperMC`'s Velocity implementation: <https://github.com/PaperMC/Paper/blob/master/patches/server/0731-Add-Velocity-IP-Forwarding-Support.patch>
|
||||
/// I had to understand the code logic by looking at `PaperMC`'s Velocity implementation: <https://github.com/PaperMC/Paper/blob/0cf731589a3b6923542cdfc36dbcee9c47c51076/paper-server/src/main/java/com/destroystokyo/paper/proxy/VelocityProxy.java>
|
||||
use std::{
|
||||
io::Read,
|
||||
net::{IpAddr, SocketAddr},
|
||||
|
||||
@@ -51,9 +51,9 @@ pub struct Server {
|
||||
/// Handles cryptographic keys for secure communication.
|
||||
key_store: KeyStore,
|
||||
/// Manages server status information.
|
||||
server_listing: Mutex<CachedStatus>,
|
||||
listing: Mutex<CachedStatus>,
|
||||
/// Saves server branding information.
|
||||
server_branding: CachedBranding,
|
||||
branding: CachedBranding,
|
||||
/// Saves and dispatches commands to appropriate handlers.
|
||||
pub command_dispatcher: RwLock<CommandDispatcher>,
|
||||
/// Block behaviour.
|
||||
@@ -74,6 +74,9 @@ pub struct Server {
|
||||
container_id: AtomicU32,
|
||||
/// Manages authentication with an authentication server, if enabled.
|
||||
pub auth_client: Option<reqwest::Client>,
|
||||
/// Mojang's public keys, used for chat session signing
|
||||
/// Pulled from Mojang API on startup
|
||||
pub mojang_public_keys: Mutex<Vec<RsaPublicKey>>,
|
||||
/// The server's custom bossbars
|
||||
pub bossbars: Mutex<CustomBossbars>,
|
||||
/// The default gamemode when a player joins the server (reset every restart)
|
||||
@@ -81,9 +84,6 @@ pub struct Server {
|
||||
/// Manages player data storage
|
||||
pub player_data_storage: ServerPlayerData,
|
||||
tasks: TaskTracker,
|
||||
/// Mojang's public keys, used for chat session signing
|
||||
/// Pulled from Mojang API on startup
|
||||
pub mojang_public_keys: Mutex<Vec<RsaPublicKey>>,
|
||||
}
|
||||
|
||||
impl Server {
|
||||
@@ -133,8 +133,8 @@ impl Server {
|
||||
item_registry: super::item::items::default_registry(),
|
||||
auth_client,
|
||||
key_store: KeyStore::new(),
|
||||
server_listing: Mutex::new(CachedStatus::new()),
|
||||
server_branding: CachedBranding::new(),
|
||||
listing: Mutex::new(CachedStatus::new()),
|
||||
branding: CachedBranding::new(),
|
||||
bossbars: Mutex::new(CustomBossbars::new()),
|
||||
defaultgamemode: Mutex::new(DefaultGamemode {
|
||||
gamemode: BASIC_CONFIG.default_gamemode,
|
||||
@@ -225,7 +225,7 @@ impl Server {
|
||||
if let Some(config) = player.client.config.lock().await.as_ref() {
|
||||
// TODO: Config so we can also just ignore this hehe
|
||||
if config.server_listing {
|
||||
self.server_listing.lock().await.add_player();
|
||||
self.listing.lock().await.add_player();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ impl Server {
|
||||
|
||||
pub async fn remove_player(&self) {
|
||||
// TODO: Config if we want decrease online
|
||||
self.server_listing.lock().await.remove_player();
|
||||
self.listing.lock().await.remove_player();
|
||||
}
|
||||
|
||||
pub async fn shutdown(&self) {
|
||||
@@ -469,11 +469,11 @@ impl Server {
|
||||
}
|
||||
|
||||
pub fn get_branding(&self) -> CPluginMessage<'_> {
|
||||
self.server_branding.get_branding()
|
||||
self.branding.get_branding()
|
||||
}
|
||||
|
||||
pub fn get_status(&self) -> &Mutex<CachedStatus> {
|
||||
&self.server_listing
|
||||
&self.listing
|
||||
}
|
||||
|
||||
pub fn encryption_request<'a>(
|
||||
|
||||
@@ -2,7 +2,7 @@ use chrono::{Datelike, Local};
|
||||
use pumpkin_config::advanced_config;
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
|
||||
// Infact Mojang also has some Seasonal Events, so we can use that later to match Vanilla :D
|
||||
// In fact Mojang also has some Seasonal Events, so we can use that later to match Vanilla :D
|
||||
|
||||
#[must_use]
|
||||
pub fn is_april() -> bool {
|
||||
|
||||
@@ -41,7 +41,8 @@ impl Explosion {
|
||||
let mut h = self.power * (0.7 + rand::random::<f32>() * 0.6);
|
||||
while h > 0.0 {
|
||||
let block_pos = BlockPos::floored(pos_x, pos_y, pos_z);
|
||||
let block = world.get_block(&block_pos).await.unwrap();
|
||||
let (block, state) =
|
||||
world.get_block_and_block_state(&block_pos).await.unwrap();
|
||||
|
||||
// if !world.is_in_build_limit(&block_pos) {
|
||||
// // Pass by reference
|
||||
@@ -49,8 +50,7 @@ impl Explosion {
|
||||
// }
|
||||
|
||||
// TODO: This should only check air & fluid
|
||||
// AIR has blast_resistance of 0
|
||||
if block.blast_resistance > 0.0 {
|
||||
if !state.air {
|
||||
h -= (block.blast_resistance + 0.3) * 0.3;
|
||||
}
|
||||
if h > 0.0 {
|
||||
|
||||
@@ -296,12 +296,12 @@ impl World {
|
||||
offset: Vector3<f32>,
|
||||
max_speed: f32,
|
||||
particle_count: i32,
|
||||
pariticle: Particle,
|
||||
particle: Particle,
|
||||
) {
|
||||
let players = self.players.read().await;
|
||||
for (_, player) in players.iter() {
|
||||
player
|
||||
.spawn_particle(position, offset, max_speed, particle_count, pariticle)
|
||||
.spawn_particle(position, offset, max_speed, particle_count, particle)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
@@ -1479,11 +1479,11 @@ impl World {
|
||||
|
||||
pub async fn get_chunk(&self, position: &BlockPos) -> Arc<RwLock<ChunkData>> {
|
||||
let (chunk_coordinate, _) = position.chunk_and_chunk_relative_position();
|
||||
let chunk = match self.level.try_get_chunk(chunk_coordinate) {
|
||||
|
||||
match self.level.try_get_chunk(chunk_coordinate) {
|
||||
Some(chunk) => chunk.clone(),
|
||||
None => self.receive_chunk(chunk_coordinate).await.0,
|
||||
};
|
||||
chunk
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_block_state_id(&self, position: &BlockPos) -> Result<u16, GetBlockError> {
|
||||
|
||||
Reference in New Issue
Block a user