Some minor improvements
This commit is contained in:
parent
4763fa356c
commit
d0d0f35a94
@ -35,7 +35,7 @@ debug = true
|
|||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
tokio = { version = "1.41", features = [
|
tokio = { version = "1.42", features = [
|
||||||
"fs",
|
"fs",
|
||||||
"io-util",
|
"io-util",
|
||||||
"macros",
|
"macros",
|
||||||
|
|||||||
@ -11,12 +11,8 @@ pub struct Deserializer<'a> {
|
|||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum DeserializerError {
|
pub enum DeserializerError {
|
||||||
#[error("Unknown Packet")]
|
|
||||||
UnknownPacket,
|
|
||||||
#[error("serializer error {0}")]
|
#[error("serializer error {0}")]
|
||||||
Message(String),
|
Message(String),
|
||||||
#[error("Stdio error {0}")]
|
|
||||||
Stdio(std::io::Error),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl de::Error for DeserializerError {
|
impl de::Error for DeserializerError {
|
||||||
|
|||||||
@ -34,7 +34,7 @@ impl ClientPacket for CCommandSuggestions<'_> {
|
|||||||
bytebuf.put_var_int(&self.length);
|
bytebuf.put_var_int(&self.length);
|
||||||
|
|
||||||
bytebuf.put_list(&self.matches, |bytebuf, suggestion| {
|
bytebuf.put_list(&self.matches, |bytebuf, suggestion| {
|
||||||
bytebuf.put_string(suggestion.suggestion.as_str());
|
bytebuf.put_string(suggestion.suggestion);
|
||||||
bytebuf.put_bool(suggestion.tooltip.is_some());
|
bytebuf.put_bool(suggestion.tooltip.is_some());
|
||||||
if let Some(tooltip) = &suggestion.tooltip {
|
if let Some(tooltip) = &suggestion.tooltip {
|
||||||
bytebuf.put_slice(&tooltip.encode());
|
bytebuf.put_slice(&tooltip.encode());
|
||||||
@ -45,12 +45,12 @@ impl ClientPacket for CCommandSuggestions<'_> {
|
|||||||
|
|
||||||
#[derive(PartialEq, Eq, Hash, Debug)]
|
#[derive(PartialEq, Eq, Hash, Debug)]
|
||||||
pub struct CommandSuggestion<'a> {
|
pub struct CommandSuggestion<'a> {
|
||||||
pub suggestion: String,
|
pub suggestion: &'a str,
|
||||||
pub tooltip: Option<TextComponent<'a>>,
|
pub tooltip: Option<TextComponent<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CommandSuggestion<'a> {
|
impl<'a> CommandSuggestion<'a> {
|
||||||
pub fn new(suggestion: String, tooltip: Option<TextComponent<'a>>) -> Self {
|
pub fn new(suggestion: &'a str, tooltip: Option<TextComponent<'a>>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
suggestion,
|
suggestion,
|
||||||
tooltip,
|
tooltip,
|
||||||
|
|||||||
@ -8,7 +8,7 @@ pumpkin-protocol = { path = "../pumpkin-protocol" }
|
|||||||
pumpkin-nbt = { path = "../pumpkin-nbt" }
|
pumpkin-nbt = { path = "../pumpkin-nbt" }
|
||||||
pumpkin-core = { path = "../pumpkin-core" }
|
pumpkin-core = { path = "../pumpkin-core" }
|
||||||
|
|
||||||
indexmap = { version = "2.6.0", features = ["serde"] }
|
indexmap = { version = "2.7.0", features = ["serde"] }
|
||||||
|
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
|||||||
@ -22,7 +22,6 @@ num-traits.workspace = true
|
|||||||
num-derive.workspace = true
|
num-derive.workspace = true
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
dashmap = "6.1.0"
|
dashmap = "6.1.0"
|
||||||
lazy_static = "1.5.0"
|
|
||||||
|
|
||||||
# Compression
|
# Compression
|
||||||
flate2 = "1.0"
|
flate2 = "1.0"
|
||||||
|
|||||||
@ -74,9 +74,7 @@ pub trait NoisePosImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub mod built_in_density_function {
|
pub mod built_in_density_function {
|
||||||
use std::sync::Arc;
|
use std::sync::{Arc, LazyLock};
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
|
||||||
|
|
||||||
use crate::world_gen::noise::built_in_noise_params::{self};
|
use crate::world_gen::noise::built_in_noise_params::{self};
|
||||||
use crate::world_gen::positions::{MAX_COLUMN_HEIGHT, MIN_HEIGHT};
|
use crate::world_gen::positions::{MAX_COLUMN_HEIGHT, MIN_HEIGHT};
|
||||||
@ -106,136 +104,153 @@ pub mod built_in_density_function {
|
|||||||
|
|
||||||
use super::weird::{RarityMapper, WierdScaledFunction};
|
use super::weird::{RarityMapper, WierdScaledFunction};
|
||||||
|
|
||||||
lazy_static! {
|
pub static ZERO: LazyLock<SharedComponentReference> =
|
||||||
pub static ref ZERO: SharedComponentReference = ConstantFunction::new(0f64).into();
|
LazyLock::new(|| ConstantFunction::new(0f64).into());
|
||||||
pub static ref TEN: SharedComponentReference = ConstantFunction::new(10f64).into();
|
pub static TEN: LazyLock<SharedComponentReference> =
|
||||||
pub static ref BLEND_ALPHA: SharedComponentReference = BlendAlphaFunction::INSTANCE.into();
|
LazyLock::new(|| ConstantFunction::new(10f64).into());
|
||||||
pub static ref BLEND_OFFSET: SharedComponentReference =
|
pub static BLEND_ALPHA: LazyLock<SharedComponentReference> =
|
||||||
BlendOffsetFunction::INSTANCE.into();
|
LazyLock::new(|| BlendAlphaFunction::INSTANCE.into());
|
||||||
pub static ref Y: SharedComponentReference = YClampedFunction::new(
|
pub static BLEND_OFFSET: LazyLock<SharedComponentReference> =
|
||||||
|
LazyLock::new(|| BlendOffsetFunction::INSTANCE.into());
|
||||||
|
pub static Y: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
YClampedFunction::new(
|
||||||
MIN_HEIGHT * 2,
|
MIN_HEIGHT * 2,
|
||||||
MAX_COLUMN_HEIGHT as i32 * 2,
|
MAX_COLUMN_HEIGHT as i32 * 2,
|
||||||
(MIN_HEIGHT * 2) as f64,
|
(MIN_HEIGHT * 2) as f64,
|
||||||
((MAX_COLUMN_HEIGHT as i32) * 2) as f64
|
((MAX_COLUMN_HEIGHT as i32) * 2) as f64,
|
||||||
)
|
)
|
||||||
.into();
|
.into()
|
||||||
pub static ref SHIFT_X: SharedComponentReference =
|
});
|
||||||
|
pub static SHIFT_X: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
ShiftAFunction::new(Arc::new(InternalNoise::new(
|
||||||
ShiftAFunction::new(Arc::new(InternalNoise::new(
|
&built_in_noise_params::OFFSET,
|
||||||
&built_in_noise_params::OFFSET,
|
None,
|
||||||
None
|
)))
|
||||||
)))
|
|
||||||
.into(),
|
|
||||||
WrapperType::Cache2D
|
|
||||||
)
|
|
||||||
.into(),
|
.into(),
|
||||||
WrapperType::FlatCache
|
WrapperType::Cache2D,
|
||||||
)
|
)
|
||||||
.into();
|
.into(),
|
||||||
pub static ref SHIFT_Z: SharedComponentReference =
|
WrapperType::FlatCache,
|
||||||
|
)
|
||||||
|
.into()
|
||||||
|
});
|
||||||
|
pub static SHIFT_Z: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
ShiftBFunction::new(Arc::new(InternalNoise::new(
|
||||||
ShiftBFunction::new(Arc::new(InternalNoise::new(
|
&built_in_noise_params::OFFSET,
|
||||||
&built_in_noise_params::OFFSET,
|
None,
|
||||||
None
|
)))
|
||||||
)))
|
|
||||||
.into(),
|
|
||||||
WrapperType::Cache2D
|
|
||||||
)
|
|
||||||
.into(),
|
.into(),
|
||||||
WrapperType::FlatCache
|
WrapperType::Cache2D,
|
||||||
)
|
)
|
||||||
.into();
|
.into(),
|
||||||
pub static ref BASE_3D_NOISE_OVERWORLD: SharedComponentReference =
|
WrapperType::FlatCache,
|
||||||
InterpolatedNoiseFunction::create_base_3d_noise_function(
|
)
|
||||||
0.25f64, 0.125f64, 80f64, 160f64, 8f64
|
.into()
|
||||||
|
});
|
||||||
|
pub static BASE_3D_NOISE_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
InterpolatedNoiseFunction::create_base_3d_noise_function(
|
||||||
|
0.25f64, 0.125f64, 80f64, 160f64, 8f64,
|
||||||
|
)
|
||||||
|
.into()
|
||||||
|
});
|
||||||
|
pub static BASE_3D_NOISE_NETHER: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
InterpolatedNoiseFunction::create_base_3d_noise_function(
|
||||||
|
0.25f64, 0.375f64, 80f64, 60f64, 8f64,
|
||||||
|
)
|
||||||
|
.into()
|
||||||
|
});
|
||||||
|
pub static BASE_3D_NOISE_END: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
InterpolatedNoiseFunction::create_base_3d_noise_function(
|
||||||
|
0.25f64, 0.25f64, 80f64, 160f64, 4f64,
|
||||||
|
)
|
||||||
|
.into()
|
||||||
|
});
|
||||||
|
pub static CONTINENTS_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
|
ShiftedNoiseFunction::<
|
||||||
|
NoEnvironment,
|
||||||
|
SharedComponentReference,
|
||||||
|
SharedComponentReference,
|
||||||
|
SharedComponentReference,
|
||||||
|
>::new(
|
||||||
|
SHIFT_X.clone(),
|
||||||
|
ZERO.clone(),
|
||||||
|
SHIFT_Z.clone(),
|
||||||
|
0.25f64,
|
||||||
|
0f64,
|
||||||
|
Arc::new(InternalNoise::new(
|
||||||
|
&built_in_noise_params::CONTINENTALNESS,
|
||||||
|
None,
|
||||||
|
)),
|
||||||
)
|
)
|
||||||
.into();
|
.into(),
|
||||||
pub static ref BASE_3D_NOISE_NETHER: SharedComponentReference =
|
WrapperType::FlatCache,
|
||||||
InterpolatedNoiseFunction::create_base_3d_noise_function(
|
)
|
||||||
0.25f64, 0.375f64, 80f64, 60f64, 8f64
|
.into()
|
||||||
|
});
|
||||||
|
pub static EROSION_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
|
ShiftedNoiseFunction::<
|
||||||
|
NoEnvironment,
|
||||||
|
SharedComponentReference,
|
||||||
|
SharedComponentReference,
|
||||||
|
SharedComponentReference,
|
||||||
|
>::new(
|
||||||
|
SHIFT_X.clone(),
|
||||||
|
ZERO.clone(),
|
||||||
|
SHIFT_Z.clone(),
|
||||||
|
0.25f64,
|
||||||
|
0f64,
|
||||||
|
Arc::new(InternalNoise::new(&built_in_noise_params::EROSION, None)),
|
||||||
)
|
)
|
||||||
.into();
|
.into(),
|
||||||
pub static ref BASE_3D_NOISE_END: SharedComponentReference =
|
WrapperType::FlatCache,
|
||||||
InterpolatedNoiseFunction::create_base_3d_noise_function(
|
)
|
||||||
0.25f64, 0.25f64, 80f64, 160f64, 4f64
|
.into()
|
||||||
|
});
|
||||||
|
pub static RIDGES_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
|
ShiftedNoiseFunction::<
|
||||||
|
NoEnvironment,
|
||||||
|
SharedComponentReference,
|
||||||
|
SharedComponentReference,
|
||||||
|
SharedComponentReference,
|
||||||
|
>::new(
|
||||||
|
SHIFT_X.clone(),
|
||||||
|
ZERO.clone(),
|
||||||
|
SHIFT_Z.clone(),
|
||||||
|
0.25f64,
|
||||||
|
0f64,
|
||||||
|
Arc::new(InternalNoise::new(&built_in_noise_params::RIDGE, None)),
|
||||||
)
|
)
|
||||||
.into();
|
.into(),
|
||||||
pub static ref CONTINENTS_OVERWORLD: SharedComponentReference =
|
WrapperType::FlatCache,
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
)
|
||||||
ShiftedNoiseFunction::<
|
.into()
|
||||||
NoEnvironment,
|
});
|
||||||
SharedComponentReference,
|
pub static RIDGES_FOLDED_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
SharedComponentReference,
|
RIDGES_OVERWORLD
|
||||||
SharedComponentReference,
|
|
||||||
>::new(
|
|
||||||
SHIFT_X.clone(),
|
|
||||||
ZERO.clone(),
|
|
||||||
SHIFT_Z.clone(),
|
|
||||||
0.25f64,
|
|
||||||
0f64,
|
|
||||||
Arc::new(InternalNoise::new(
|
|
||||||
&built_in_noise_params::CONTINENTALNESS,
|
|
||||||
None
|
|
||||||
))
|
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
WrapperType::FlatCache
|
|
||||||
)
|
|
||||||
.into();
|
|
||||||
pub static ref EROSION_OVERWORLD: SharedComponentReference =
|
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
|
||||||
ShiftedNoiseFunction::<
|
|
||||||
NoEnvironment,
|
|
||||||
SharedComponentReference,
|
|
||||||
SharedComponentReference,
|
|
||||||
SharedComponentReference,
|
|
||||||
>::new(
|
|
||||||
SHIFT_X.clone(),
|
|
||||||
ZERO.clone(),
|
|
||||||
SHIFT_Z.clone(),
|
|
||||||
0.25f64,
|
|
||||||
0f64,
|
|
||||||
Arc::new(InternalNoise::new(&built_in_noise_params::EROSION, None))
|
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
WrapperType::FlatCache
|
|
||||||
)
|
|
||||||
.into();
|
|
||||||
pub static ref RIDGES_OVERWORLD: SharedComponentReference =
|
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
|
||||||
ShiftedNoiseFunction::<
|
|
||||||
NoEnvironment,
|
|
||||||
SharedComponentReference,
|
|
||||||
SharedComponentReference,
|
|
||||||
SharedComponentReference,
|
|
||||||
>::new(
|
|
||||||
SHIFT_X.clone(),
|
|
||||||
ZERO.clone(),
|
|
||||||
SHIFT_Z.clone(),
|
|
||||||
0.25f64,
|
|
||||||
0f64,
|
|
||||||
Arc::new(InternalNoise::new(&built_in_noise_params::RIDGE, None))
|
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
WrapperType::FlatCache
|
|
||||||
)
|
|
||||||
.into();
|
|
||||||
pub static ref RIDGES_FOLDED_OVERWORLD: SharedComponentReference = RIDGES_OVERWORLD
|
|
||||||
.clone()
|
.clone()
|
||||||
.abs()
|
.abs()
|
||||||
.add_const(-0.6666666666666666f64)
|
.add_const(-0.6666666666666666f64)
|
||||||
.abs()
|
.abs()
|
||||||
.add_const(-0.3333333333333333f64)
|
.add_const(-0.3333333333333333f64)
|
||||||
.mul_const(-3f64);
|
.mul_const(-3f64)
|
||||||
static ref JAGGED_NOISE: SharedComponentReference = NoiseFunction::new(
|
});
|
||||||
|
static JAGGED_NOISE: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
NoiseFunction::new(
|
||||||
Arc::new(InternalNoise::new(&built_in_noise_params::JAGGED, None)),
|
Arc::new(InternalNoise::new(&built_in_noise_params::JAGGED, None)),
|
||||||
1500f64,
|
1500f64,
|
||||||
0f64
|
0f64,
|
||||||
)
|
)
|
||||||
.into();
|
.into()
|
||||||
pub static ref OFFSET_OVERWORLD: SharedComponentReference = apply_blending(
|
});
|
||||||
|
pub static OFFSET_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
apply_blending(
|
||||||
ConstantFunction::new(-0.50375f32 as f64).add(
|
ConstantFunction::new(-0.50375f32 as f64).add(
|
||||||
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
||||||
create_offset_spline(
|
create_offset_spline(
|
||||||
@ -244,13 +259,15 @@ pub mod built_in_density_function {
|
|||||||
RIDGES_FOLDED_OVERWORLD.clone(),
|
RIDGES_FOLDED_OVERWORLD.clone(),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
),
|
),
|
||||||
BLEND_OFFSET.clone(),
|
BLEND_OFFSET.clone(),
|
||||||
);
|
)
|
||||||
pub static ref FACTOR_OVERWORLD: SharedComponentReference = apply_blending(
|
});
|
||||||
|
pub static FACTOR_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
apply_blending(
|
||||||
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
||||||
create_factor_spline(
|
create_factor_spline(
|
||||||
CONTINENTS_OVERWORLD.clone(),
|
CONTINENTS_OVERWORLD.clone(),
|
||||||
@ -259,12 +276,14 @@ pub mod built_in_density_function {
|
|||||||
RIDGES_FOLDED_OVERWORLD.clone(),
|
RIDGES_FOLDED_OVERWORLD.clone(),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
TEN.clone(),
|
TEN.clone(),
|
||||||
);
|
)
|
||||||
pub static ref JAGGEDNESS_OVERWORLD: SharedComponentReference = apply_blending(
|
});
|
||||||
|
pub static JAGGEDNESS_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
apply_blending(
|
||||||
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
||||||
create_jaggedness_spline(
|
create_jaggedness_spline(
|
||||||
CONTINENTS_OVERWORLD.clone(),
|
CONTINENTS_OVERWORLD.clone(),
|
||||||
@ -273,28 +292,31 @@ pub mod built_in_density_function {
|
|||||||
RIDGES_FOLDED_OVERWORLD.clone(),
|
RIDGES_FOLDED_OVERWORLD.clone(),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
ZERO.clone(),
|
ZERO.clone(),
|
||||||
);
|
)
|
||||||
pub static ref DEPTH_OVERWORLD: SharedComponentReference =
|
});
|
||||||
YClampedFunction::new(-64, 320, 1.5f64, -1.5f64).add(OFFSET_OVERWORLD.clone());
|
pub static DEPTH_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
pub static ref SLOPED_CHEESE_OVERWORLD: SharedComponentReference = {
|
YClampedFunction::new(-64, 320, 1.5f64, -1.5f64).add(OFFSET_OVERWORLD.clone())
|
||||||
let density1 = JAGGEDNESS_OVERWORLD
|
});
|
||||||
|
pub static SLOPED_CHEESE_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
let density1 = JAGGEDNESS_OVERWORLD
|
||||||
|
.clone()
|
||||||
|
.mul(JAGGED_NOISE.clone().half_negative());
|
||||||
|
let density2 = ConstantFunction::new(4f64).mul(
|
||||||
|
DEPTH_OVERWORLD
|
||||||
.clone()
|
.clone()
|
||||||
.mul(JAGGED_NOISE.clone().half_negative());
|
.add(density1)
|
||||||
let density2 = ConstantFunction::new(4f64).mul(
|
.mul(FACTOR_OVERWORLD.clone())
|
||||||
DEPTH_OVERWORLD
|
.quarter_negative(),
|
||||||
.clone()
|
);
|
||||||
.add(density1)
|
|
||||||
.mul(FACTOR_OVERWORLD.clone())
|
|
||||||
.quarter_negative(),
|
|
||||||
);
|
|
||||||
|
|
||||||
density2.add(BASE_3D_NOISE_OVERWORLD.clone())
|
density2.add(BASE_3D_NOISE_OVERWORLD.clone())
|
||||||
};
|
});
|
||||||
pub static ref CONTINENTS_OVERWORLD_LARGE_BIOME: SharedComponentReference =
|
pub static CONTINENTS_OVERWORLD_LARGE_BIOME: LazyLock<SharedComponentReference> =
|
||||||
|
LazyLock::new(|| {
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
ShiftedNoiseFunction::<
|
ShiftedNoiseFunction::<
|
||||||
NoEnvironment,
|
NoEnvironment,
|
||||||
@ -309,14 +331,16 @@ pub mod built_in_density_function {
|
|||||||
0f64,
|
0f64,
|
||||||
Arc::new(InternalNoise::new(
|
Arc::new(InternalNoise::new(
|
||||||
&built_in_noise_params::CONTINENTALNESS_LARGE,
|
&built_in_noise_params::CONTINENTALNESS_LARGE,
|
||||||
None
|
None,
|
||||||
))
|
)),
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
WrapperType::FlatCache
|
WrapperType::FlatCache,
|
||||||
)
|
)
|
||||||
.into();
|
.into()
|
||||||
pub static ref EROSION_OVERWORLD_LARGE_BIOME: SharedComponentReference =
|
});
|
||||||
|
pub static EROSION_OVERWORLD_LARGE_BIOME: LazyLock<SharedComponentReference> =
|
||||||
|
LazyLock::new(|| {
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
ShiftedNoiseFunction::<
|
ShiftedNoiseFunction::<
|
||||||
NoEnvironment,
|
NoEnvironment,
|
||||||
@ -331,60 +355,73 @@ pub mod built_in_density_function {
|
|||||||
0f64,
|
0f64,
|
||||||
Arc::new(InternalNoise::new(
|
Arc::new(InternalNoise::new(
|
||||||
&built_in_noise_params::EROSION_LARGE,
|
&built_in_noise_params::EROSION_LARGE,
|
||||||
None
|
None,
|
||||||
))
|
)),
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
WrapperType::FlatCache
|
WrapperType::FlatCache,
|
||||||
)
|
)
|
||||||
.into();
|
.into()
|
||||||
pub static ref OFFSET_OVERWORLD_LARGE_BIOME: SharedComponentReference = apply_blending(
|
});
|
||||||
ConstantFunction::new(-0.50375f32 as f64).add(
|
pub static OFFSET_OVERWORLD_LARGE_BIOME: LazyLock<SharedComponentReference> =
|
||||||
|
LazyLock::new(|| {
|
||||||
|
apply_blending(
|
||||||
|
ConstantFunction::new(-0.50375f32 as f64).add(
|
||||||
|
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
||||||
|
create_offset_spline(
|
||||||
|
CONTINENTS_OVERWORLD_LARGE_BIOME.clone(),
|
||||||
|
EROSION_OVERWORLD_LARGE_BIOME.clone(),
|
||||||
|
RIDGES_FOLDED_OVERWORLD.clone(),
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
),
|
||||||
|
BLEND_OFFSET.clone(),
|
||||||
|
)
|
||||||
|
});
|
||||||
|
pub static FACTOR_OVERWORLD_LARGE_BIOME: LazyLock<SharedComponentReference> =
|
||||||
|
LazyLock::new(|| {
|
||||||
|
apply_blending(
|
||||||
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
||||||
create_offset_spline(
|
create_factor_spline(
|
||||||
CONTINENTS_OVERWORLD_LARGE_BIOME.clone(),
|
CONTINENTS_OVERWORLD_LARGE_BIOME.clone(),
|
||||||
EROSION_OVERWORLD_LARGE_BIOME.clone(),
|
EROSION_OVERWORLD_LARGE_BIOME.clone(),
|
||||||
|
RIDGES_OVERWORLD.clone(),
|
||||||
RIDGES_FOLDED_OVERWORLD.clone(),
|
RIDGES_FOLDED_OVERWORLD.clone(),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
),
|
TEN.clone(),
|
||||||
BLEND_OFFSET.clone()
|
|
||||||
);
|
|
||||||
pub static ref FACTOR_OVERWORLD_LARGE_BIOME: SharedComponentReference = apply_blending(
|
|
||||||
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
|
||||||
create_factor_spline(
|
|
||||||
CONTINENTS_OVERWORLD_LARGE_BIOME.clone(),
|
|
||||||
EROSION_OVERWORLD_LARGE_BIOME.clone(),
|
|
||||||
RIDGES_OVERWORLD.clone(),
|
|
||||||
RIDGES_FOLDED_OVERWORLD.clone(),
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.into()
|
|
||||||
)
|
)
|
||||||
.into(),
|
});
|
||||||
TEN.clone()
|
pub static JAGGEDNESS_OVERWORLD_LARGE_BIOME: LazyLock<SharedComponentReference> =
|
||||||
);
|
LazyLock::new(|| {
|
||||||
pub static ref JAGGEDNESS_OVERWORLD_LARGE_BIOME: SharedComponentReference = apply_blending(
|
apply_blending(
|
||||||
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
||||||
create_jaggedness_spline(
|
create_jaggedness_spline(
|
||||||
CONTINENTS_OVERWORLD_LARGE_BIOME.clone(),
|
CONTINENTS_OVERWORLD_LARGE_BIOME.clone(),
|
||||||
EROSION_OVERWORLD_LARGE_BIOME.clone(),
|
EROSION_OVERWORLD_LARGE_BIOME.clone(),
|
||||||
RIDGES_OVERWORLD.clone(),
|
RIDGES_OVERWORLD.clone(),
|
||||||
RIDGES_FOLDED_OVERWORLD.clone(),
|
RIDGES_FOLDED_OVERWORLD.clone(),
|
||||||
false,
|
false,
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
|
ZERO.clone(),
|
||||||
)
|
)
|
||||||
.into(),
|
});
|
||||||
ZERO.clone()
|
pub static DEPTH_OVERWORLD_LARGE_BIOME: LazyLock<SharedComponentReference> =
|
||||||
);
|
LazyLock::new(|| {
|
||||||
pub static ref DEPTH_OVERWORLD_LARGE_BIOME: SharedComponentReference =
|
|
||||||
YClampedFunction::new(-64, 320, 1.5f64, -1.5f64)
|
YClampedFunction::new(-64, 320, 1.5f64, -1.5f64)
|
||||||
.add(OFFSET_OVERWORLD_LARGE_BIOME.clone());
|
.add(OFFSET_OVERWORLD_LARGE_BIOME.clone())
|
||||||
pub static ref SLOPED_CHEESE_OVERWORLD_LARGE_BIOME: SharedComponentReference = {
|
});
|
||||||
|
pub static SLOPED_CHEESE_OVERWORLD_LARGE_BIOME: LazyLock<SharedComponentReference> =
|
||||||
|
LazyLock::new(|| {
|
||||||
let density1 = JAGGEDNESS_OVERWORLD_LARGE_BIOME
|
let density1 = JAGGEDNESS_OVERWORLD_LARGE_BIOME
|
||||||
.clone()
|
.clone()
|
||||||
.mul(JAGGED_NOISE.clone().half_negative());
|
.mul(JAGGED_NOISE.clone().half_negative());
|
||||||
@ -397,54 +434,65 @@ pub mod built_in_density_function {
|
|||||||
);
|
);
|
||||||
|
|
||||||
density2.add(BASE_3D_NOISE_OVERWORLD.clone())
|
density2.add(BASE_3D_NOISE_OVERWORLD.clone())
|
||||||
};
|
});
|
||||||
pub static ref OFFSET_OVERWORLD_AMPLIFIED: SharedComponentReference = apply_blending(
|
pub static OFFSET_OVERWORLD_AMPLIFIED: LazyLock<SharedComponentReference> =
|
||||||
ConstantFunction::new(-0.50375f32 as f64).add(
|
LazyLock::new(|| {
|
||||||
|
apply_blending(
|
||||||
|
ConstantFunction::new(-0.50375f32 as f64).add(
|
||||||
|
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
||||||
|
create_offset_spline(
|
||||||
|
CONTINENTS_OVERWORLD.clone(),
|
||||||
|
EROSION_OVERWORLD.clone(),
|
||||||
|
RIDGES_FOLDED_OVERWORLD.clone(),
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
),
|
||||||
|
BLEND_OFFSET.clone(),
|
||||||
|
)
|
||||||
|
});
|
||||||
|
pub static FACTOR_OVERWORLD_AMPLIFIED: LazyLock<SharedComponentReference> =
|
||||||
|
LazyLock::new(|| {
|
||||||
|
apply_blending(
|
||||||
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
||||||
create_offset_spline(
|
create_factor_spline(
|
||||||
CONTINENTS_OVERWORLD.clone(),
|
CONTINENTS_OVERWORLD.clone(),
|
||||||
EROSION_OVERWORLD.clone(),
|
EROSION_OVERWORLD.clone(),
|
||||||
|
RIDGES_OVERWORLD.clone(),
|
||||||
RIDGES_FOLDED_OVERWORLD.clone(),
|
RIDGES_FOLDED_OVERWORLD.clone(),
|
||||||
true
|
true,
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
),
|
TEN.clone(),
|
||||||
BLEND_OFFSET.clone()
|
|
||||||
);
|
|
||||||
pub static ref FACTOR_OVERWORLD_AMPLIFIED: SharedComponentReference = apply_blending(
|
|
||||||
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
|
||||||
create_factor_spline(
|
|
||||||
CONTINENTS_OVERWORLD.clone(),
|
|
||||||
EROSION_OVERWORLD.clone(),
|
|
||||||
RIDGES_OVERWORLD.clone(),
|
|
||||||
RIDGES_FOLDED_OVERWORLD.clone(),
|
|
||||||
true
|
|
||||||
)
|
|
||||||
.into()
|
|
||||||
)
|
)
|
||||||
.into(),
|
});
|
||||||
TEN.clone()
|
pub static JAGGEDNESS_OVERWORLD_AMPLIFIED: LazyLock<SharedComponentReference> =
|
||||||
);
|
LazyLock::new(|| {
|
||||||
pub static ref JAGGEDNESS_OVERWORLD_AMPLIFIED: SharedComponentReference = apply_blending(
|
apply_blending(
|
||||||
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
SplineFunction::<NoEnvironment, ImmutableSplineRef>::new(
|
||||||
create_jaggedness_spline(
|
create_jaggedness_spline(
|
||||||
CONTINENTS_OVERWORLD.clone(),
|
CONTINENTS_OVERWORLD.clone(),
|
||||||
EROSION_OVERWORLD.clone(),
|
EROSION_OVERWORLD.clone(),
|
||||||
RIDGES_OVERWORLD.clone(),
|
RIDGES_OVERWORLD.clone(),
|
||||||
RIDGES_FOLDED_OVERWORLD.clone(),
|
RIDGES_FOLDED_OVERWORLD.clone(),
|
||||||
true
|
true,
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
|
ZERO.clone(),
|
||||||
)
|
)
|
||||||
.into(),
|
});
|
||||||
ZERO.clone()
|
pub static DEPTH_OVERWORLD_AMPLIFIED: LazyLock<SharedComponentReference> =
|
||||||
);
|
LazyLock::new(|| {
|
||||||
pub static ref DEPTH_OVERWORLD_AMPLIFIED: SharedComponentReference =
|
YClampedFunction::new(-64, 320, 1.5f64, -1.5f64).add(OFFSET_OVERWORLD_AMPLIFIED.clone())
|
||||||
YClampedFunction::new(-64, 320, 1.5f64, -1.5f64)
|
});
|
||||||
.add(OFFSET_OVERWORLD_AMPLIFIED.clone());
|
pub static SLOPED_CHEESE_OVERWORLD_AMPLIFIED: LazyLock<SharedComponentReference> =
|
||||||
pub static ref SLOPED_CHEESE_OVERWORLD_AMPLIFIED: SharedComponentReference = {
|
LazyLock::new(|| {
|
||||||
let density1 = JAGGEDNESS_OVERWORLD_AMPLIFIED
|
let density1 = JAGGEDNESS_OVERWORLD_AMPLIFIED
|
||||||
.clone()
|
.clone()
|
||||||
.mul(JAGGED_NOISE.clone().half_negative());
|
.mul(JAGGED_NOISE.clone().half_negative());
|
||||||
@ -457,10 +505,11 @@ pub mod built_in_density_function {
|
|||||||
);
|
);
|
||||||
|
|
||||||
density2.add(BASE_3D_NOISE_OVERWORLD.clone())
|
density2.add(BASE_3D_NOISE_OVERWORLD.clone())
|
||||||
};
|
});
|
||||||
pub static ref SLOPED_CHEESE_END: SharedComponentReference =
|
pub static SLOPED_CHEESE_END: LazyLock<SharedComponentReference> =
|
||||||
EndIslandFunction::new(0).add(BASE_3D_NOISE_END.clone());
|
LazyLock::new(|| EndIslandFunction::new(0).add(BASE_3D_NOISE_END.clone()));
|
||||||
pub static ref CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD: SharedComponentReference = {
|
pub static CAVES_SPAGHETTI_ROUGHNESS_FUNCTION_OVERWORLD: LazyLock<SharedComponentReference> =
|
||||||
|
LazyLock::new(|| {
|
||||||
let function = NoiseFunction::new(
|
let function = NoiseFunction::new(
|
||||||
Arc::new(InternalNoise::new(
|
Arc::new(InternalNoise::new(
|
||||||
&built_in_noise_params::SPAGHETTI_ROUGHNESS,
|
&built_in_noise_params::SPAGHETTI_ROUGHNESS,
|
||||||
@ -483,20 +532,23 @@ pub mod built_in_density_function {
|
|||||||
WrapperType::OnceCache,
|
WrapperType::OnceCache,
|
||||||
)
|
)
|
||||||
.into()
|
.into()
|
||||||
};
|
});
|
||||||
pub static ref CAVES_SPAGHETTI_2D_THICKNESS_MODULAR_OVERWORLD: SharedComponentReference =
|
pub static CAVES_SPAGHETTI_2D_THICKNESS_MODULAR_OVERWORLD: LazyLock<SharedComponentReference> =
|
||||||
|
LazyLock::new(|| {
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
noise_in_range(
|
noise_in_range(
|
||||||
&built_in_noise_params::SPAGHETTI_2D_THICKNESS,
|
&built_in_noise_params::SPAGHETTI_2D_THICKNESS,
|
||||||
2f64,
|
2f64,
|
||||||
1f64,
|
1f64,
|
||||||
-0.6f64,
|
-0.6f64,
|
||||||
-1.3f64
|
-1.3f64,
|
||||||
),
|
),
|
||||||
WrapperType::OnceCache,
|
WrapperType::OnceCache,
|
||||||
)
|
)
|
||||||
.into();
|
.into()
|
||||||
pub static ref CAVES_SPAGHETTI_2D_OVERWORLD: SharedComponentReference = {
|
});
|
||||||
|
pub static CAVES_SPAGHETTI_2D_OVERWORLD: LazyLock<SharedComponentReference> =
|
||||||
|
LazyLock::new(|| {
|
||||||
let function1 = NoiseFunction::new(
|
let function1 = NoiseFunction::new(
|
||||||
Arc::new(InternalNoise::new(
|
Arc::new(InternalNoise::new(
|
||||||
&built_in_noise_params::SPAGHETTI_2D_MODULATOR,
|
&built_in_noise_params::SPAGHETTI_2D_MODULATOR,
|
||||||
@ -534,8 +586,9 @@ pub mod built_in_density_function {
|
|||||||
let function7 = function2.add(function4.mul_const(0.083f64));
|
let function7 = function2.add(function4.mul_const(0.083f64));
|
||||||
|
|
||||||
function7.max(function6).clamp(-1f64, 1f64)
|
function7.max(function6).clamp(-1f64, 1f64)
|
||||||
};
|
});
|
||||||
pub static ref CAVES_ENTRANCES_OVERWORLD: SharedComponentReference = {
|
pub static CAVES_ENTRANCES_OVERWORLD: LazyLock<SharedComponentReference> =
|
||||||
|
LazyLock::new(|| {
|
||||||
let function_ref: SharedComponentReference =
|
let function_ref: SharedComponentReference =
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
NoiseFunction::new(
|
NoiseFunction::new(
|
||||||
@ -601,115 +654,114 @@ pub mod built_in_density_function {
|
|||||||
WrapperType::OnceCache,
|
WrapperType::OnceCache,
|
||||||
)
|
)
|
||||||
.into()
|
.into()
|
||||||
};
|
});
|
||||||
pub static ref CAVES_NOODLE_OVERWORLD: SharedComponentReference = {
|
pub static CAVES_NOODLE_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
let function2 = vertical_range_choice(
|
let function2 = vertical_range_choice(
|
||||||
Y.clone(),
|
Y.clone(),
|
||||||
NoiseFunction::new(
|
NoiseFunction::new(
|
||||||
Arc::new(InternalNoise::new(&built_in_noise_params::NOODLE, None)),
|
Arc::new(InternalNoise::new(&built_in_noise_params::NOODLE, None)),
|
||||||
1f64,
|
1f64,
|
||||||
1f64,
|
1f64,
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
-60,
|
|
||||||
320,
|
|
||||||
-1,
|
|
||||||
);
|
|
||||||
|
|
||||||
let function3 = vertical_range_choice(
|
|
||||||
Y.clone(),
|
|
||||||
noise_in_range(
|
|
||||||
&built_in_noise_params::NOODLE_THICKNESS,
|
|
||||||
1f64,
|
|
||||||
1f64,
|
|
||||||
-0.05f64,
|
|
||||||
-0.1f64,
|
|
||||||
),
|
|
||||||
-60,
|
|
||||||
320,
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
|
|
||||||
let function4 = vertical_range_choice(
|
|
||||||
Y.clone(),
|
|
||||||
NoiseFunction::new(
|
|
||||||
Arc::new(InternalNoise::new(
|
|
||||||
&built_in_noise_params::NOODLE_RIDGE_A,
|
|
||||||
None,
|
|
||||||
)),
|
|
||||||
2.6666666666666665f64,
|
|
||||||
2.6666666666666665f64,
|
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
-60,
|
|
||||||
320,
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
|
|
||||||
let function5 = vertical_range_choice(
|
|
||||||
Y.clone(),
|
|
||||||
NoiseFunction::new(
|
|
||||||
Arc::new(InternalNoise::new(
|
|
||||||
&built_in_noise_params::NOODLE_RIDGE_B,
|
|
||||||
None,
|
|
||||||
)),
|
|
||||||
2.6666666666666665f64,
|
|
||||||
2.6666666666666665f64,
|
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
-60,
|
|
||||||
320,
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
|
|
||||||
let function6 = function4.abs().max(function5.abs()).mul_const(1.5f64);
|
|
||||||
|
|
||||||
RangeFunction::<
|
|
||||||
NoEnvironment,
|
|
||||||
SharedComponentReference,
|
|
||||||
SharedComponentReference,
|
|
||||||
SharedComponentReference,
|
|
||||||
>::new(
|
|
||||||
function2,
|
|
||||||
-1000000f64,
|
|
||||||
0f64,
|
|
||||||
ConstantFunction::new(64f64).into(),
|
|
||||||
function3.add(function6),
|
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
};
|
-60,
|
||||||
pub static ref CAVES_PILLARS_OVERWORLD: SharedComponentReference = {
|
320,
|
||||||
let function = NoiseFunction::new(
|
-1,
|
||||||
Arc::new(InternalNoise::new(&built_in_noise_params::PILLAR, None)),
|
);
|
||||||
25f64,
|
|
||||||
0.3f64,
|
|
||||||
);
|
|
||||||
|
|
||||||
let function2 = noise_in_range(
|
let function3 = vertical_range_choice(
|
||||||
&built_in_noise_params::PILLAR_RARENESS,
|
Y.clone(),
|
||||||
|
noise_in_range(
|
||||||
|
&built_in_noise_params::NOODLE_THICKNESS,
|
||||||
1f64,
|
1f64,
|
||||||
1f64,
|
1f64,
|
||||||
0f64,
|
-0.05f64,
|
||||||
-2f64,
|
-0.1f64,
|
||||||
);
|
),
|
||||||
|
-60,
|
||||||
|
320,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
|
||||||
let function3 = noise_in_range(
|
let function4 = vertical_range_choice(
|
||||||
&built_in_noise_params::PILLAR_THICKNESS,
|
Y.clone(),
|
||||||
1f64,
|
NoiseFunction::new(
|
||||||
1f64,
|
Arc::new(InternalNoise::new(
|
||||||
0f64,
|
&built_in_noise_params::NOODLE_RIDGE_A,
|
||||||
1.1f64,
|
None,
|
||||||
);
|
)),
|
||||||
|
2.6666666666666665f64,
|
||||||
let function4 = function.mul_const(2f64).add(function2);
|
2.6666666666666665f64,
|
||||||
|
|
||||||
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
|
||||||
function4.mul(function3.cube()),
|
|
||||||
WrapperType::OnceCache,
|
|
||||||
)
|
)
|
||||||
.into()
|
.into(),
|
||||||
};
|
-60,
|
||||||
}
|
320,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
|
||||||
|
let function5 = vertical_range_choice(
|
||||||
|
Y.clone(),
|
||||||
|
NoiseFunction::new(
|
||||||
|
Arc::new(InternalNoise::new(
|
||||||
|
&built_in_noise_params::NOODLE_RIDGE_B,
|
||||||
|
None,
|
||||||
|
)),
|
||||||
|
2.6666666666666665f64,
|
||||||
|
2.6666666666666665f64,
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
-60,
|
||||||
|
320,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
|
||||||
|
let function6 = function4.abs().max(function5.abs()).mul_const(1.5f64);
|
||||||
|
|
||||||
|
RangeFunction::<
|
||||||
|
NoEnvironment,
|
||||||
|
SharedComponentReference,
|
||||||
|
SharedComponentReference,
|
||||||
|
SharedComponentReference,
|
||||||
|
>::new(
|
||||||
|
function2,
|
||||||
|
-1000000f64,
|
||||||
|
0f64,
|
||||||
|
ConstantFunction::new(64f64).into(),
|
||||||
|
function3.add(function6),
|
||||||
|
)
|
||||||
|
.into()
|
||||||
|
});
|
||||||
|
pub static CAVES_PILLARS_OVERWORLD: LazyLock<SharedComponentReference> = LazyLock::new(|| {
|
||||||
|
let function = NoiseFunction::new(
|
||||||
|
Arc::new(InternalNoise::new(&built_in_noise_params::PILLAR, None)),
|
||||||
|
25f64,
|
||||||
|
0.3f64,
|
||||||
|
);
|
||||||
|
|
||||||
|
let function2 = noise_in_range(
|
||||||
|
&built_in_noise_params::PILLAR_RARENESS,
|
||||||
|
1f64,
|
||||||
|
1f64,
|
||||||
|
0f64,
|
||||||
|
-2f64,
|
||||||
|
);
|
||||||
|
|
||||||
|
let function3 = noise_in_range(
|
||||||
|
&built_in_noise_params::PILLAR_THICKNESS,
|
||||||
|
1f64,
|
||||||
|
1f64,
|
||||||
|
0f64,
|
||||||
|
1.1f64,
|
||||||
|
);
|
||||||
|
|
||||||
|
let function4 = function.mul_const(2f64).add(function2);
|
||||||
|
|
||||||
|
WrapperFunction::<NoEnvironment, SharedComponentReference>::new(
|
||||||
|
function4.mul(function3.cube()),
|
||||||
|
WrapperType::OnceCache,
|
||||||
|
)
|
||||||
|
.into()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn peaks_valleys_noise(variance: f32) -> f32 {
|
pub fn peaks_valleys_noise(variance: f32) -> f32 {
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::{Arc, LazyLock};
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
|
||||||
|
|
||||||
use crate::world_gen::{
|
use crate::world_gen::{
|
||||||
noise::density::{
|
noise::density::{
|
||||||
@ -37,14 +35,12 @@ use super::{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
lazy_static! {
|
pub static OVERWORLD_NOISE_ROUTER: LazyLock<BaseRouter> =
|
||||||
pub static ref OVERWORLD_NOISE_ROUTER: BaseRouter =
|
LazyLock::new(|| BaseRouter::create_surface_noise_router(false, false));
|
||||||
BaseRouter::create_surface_noise_router(false, false);
|
pub static OVERWORLD_NOISE_ROUTER_LARGE: LazyLock<BaseRouter> =
|
||||||
pub static ref OVERWORLD_NOISE_ROUTER_LARGE: BaseRouter =
|
LazyLock::new(|| BaseRouter::create_surface_noise_router(true, false));
|
||||||
BaseRouter::create_surface_noise_router(true, false);
|
pub static OVERWORLD_NOISE_ROUTER_AMPLIFIED: LazyLock<BaseRouter> =
|
||||||
pub static ref OVERWORLD_NOISE_ROUTER_AMPLIFIED: BaseRouter =
|
LazyLock::new(|| BaseRouter::create_surface_noise_router(false, true));
|
||||||
BaseRouter::create_surface_noise_router(false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct BaseRouter {
|
pub struct BaseRouter {
|
||||||
pub(crate) barrier: SharedComponentReference,
|
pub(crate) barrier: SharedComponentReference,
|
||||||
|
|||||||
@ -64,11 +64,11 @@ sha2 = "0.10.8"
|
|||||||
|
|
||||||
# icon loading
|
# icon loading
|
||||||
base64 = "0.22.1"
|
base64 = "0.22.1"
|
||||||
png = "0.17.14"
|
png = "0.17.15"
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
simple_logger = { version = "5.0.0", features = ["threads"] }
|
simple_logger = { version = "5.0.0", features = ["threads"] }
|
||||||
time = "0.3.36"
|
time = "0.3.37"
|
||||||
|
|
||||||
# commands
|
# commands
|
||||||
async-trait = "0.1.83"
|
async-trait = "0.1.83"
|
||||||
|
|||||||
@ -404,7 +404,6 @@ impl Client {
|
|||||||
"Failed to handle client packet id {} in Status State",
|
"Failed to handle client packet id {} in Status State",
|
||||||
packet.id.0
|
packet.id.0
|
||||||
);
|
);
|
||||||
return Err(DeserializerError::UnknownPacket);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -479,7 +478,6 @@ impl Client {
|
|||||||
"Failed to handle client packet id {} in Config State",
|
"Failed to handle client packet id {} in Config State",
|
||||||
packet.id.0
|
packet.id.0
|
||||||
);
|
);
|
||||||
return Err(DeserializerError::UnknownPacket);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@ -57,7 +57,7 @@ impl ArgumentConsumer for BossbarColorArgumentConsumer {
|
|||||||
let colors = ["blue", "green", "pink", "purple", "red", "white", "yellow"];
|
let colors = ["blue", "green", "pink", "purple", "red", "white", "yellow"];
|
||||||
let suggestions: Vec<CommandSuggestion> = colors
|
let suggestions: Vec<CommandSuggestion> = colors
|
||||||
.iter()
|
.iter()
|
||||||
.map(|color| CommandSuggestion::new((*color).to_string(), None))
|
.map(|color| CommandSuggestion::new(color, None))
|
||||||
.collect();
|
.collect();
|
||||||
Ok(Some(suggestions))
|
Ok(Some(suggestions))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ impl ArgumentConsumer for BossbarStyleArgumentConsumer {
|
|||||||
];
|
];
|
||||||
let suggestions: Vec<CommandSuggestion> = styles
|
let suggestions: Vec<CommandSuggestion> = styles
|
||||||
.iter()
|
.iter()
|
||||||
.map(|style| CommandSuggestion::new((*style).to_string(), None))
|
.map(|style| CommandSuggestion::new(style, None))
|
||||||
.collect();
|
.collect();
|
||||||
Ok(Some(suggestions))
|
Ok(Some(suggestions))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ impl ArgumentConsumer for CommandTreeArgumentConsumer {
|
|||||||
.commands
|
.commands
|
||||||
.keys()
|
.keys()
|
||||||
.filter(|suggestion| suggestion.starts_with(input))
|
.filter(|suggestion| suggestion.starts_with(input))
|
||||||
.map(|suggestion| CommandSuggestion::new((*suggestion).to_string(), None))
|
.map(|suggestion| CommandSuggestion::new(suggestion, None))
|
||||||
.collect();
|
.collect();
|
||||||
Ok(Some(suggestions))
|
Ok(Some(suggestions))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,17 +44,18 @@ impl ArgumentConsumer for ResourceLocationArgumentConsumer {
|
|||||||
if !self.autocomplete {
|
if !self.autocomplete {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
// TODO
|
||||||
|
|
||||||
let suggestions = _server
|
// let suggestions = server
|
||||||
.bossbars
|
// .bossbars
|
||||||
.lock()
|
// .lock()
|
||||||
.await
|
// .await
|
||||||
.custom_bossbars
|
// .custom_bossbars
|
||||||
.keys()
|
// .keys()
|
||||||
.map(|suggestion| CommandSuggestion::new(suggestion.clone(), None))
|
// .map(|suggestion| CommandSuggestion::new(suggestion, None))
|
||||||
.collect();
|
// .collect();
|
||||||
|
|
||||||
Ok(Some(suggestions))
|
Ok(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,10 +50,10 @@ impl CommandExecutor for CommandHelpExecutor {
|
|||||||
TextComponent::text_string("-".repeat((52 - header_text.len()) / 2) + " ")
|
TextComponent::text_string("-".repeat((52 - header_text.len()) / 2) + " ")
|
||||||
.color_named(NamedColor::Yellow),
|
.color_named(NamedColor::Yellow),
|
||||||
)
|
)
|
||||||
.add_child(TextComponent::text_string(header_text.clone()))
|
.add_child(TextComponent::text(&header_text))
|
||||||
.add_child(
|
.add_child(
|
||||||
TextComponent::text_string(
|
TextComponent::text_string(
|
||||||
" ".to_owned().to_string() + &"-".repeat((52 - header_text.len()) / 2) + "\n",
|
" ".to_owned() + &"-".repeat((52 - header_text.len()) / 2) + "\n",
|
||||||
)
|
)
|
||||||
.color_named(NamedColor::Yellow),
|
.color_named(NamedColor::Yellow),
|
||||||
)
|
)
|
||||||
@ -168,13 +168,11 @@ impl CommandExecutor for BaseHelpExecutor {
|
|||||||
.color_named(NamedColor::Yellow),
|
.color_named(NamedColor::Yellow),
|
||||||
)
|
)
|
||||||
.add_child(arrow_left.clone())
|
.add_child(arrow_left.clone())
|
||||||
.add_child(TextComponent::text_string(header_text.clone()))
|
.add_child(TextComponent::text(&header_text))
|
||||||
.add_child(arrow_right.clone())
|
.add_child(arrow_right.clone())
|
||||||
.add_child(
|
.add_child(
|
||||||
TextComponent::text_string(
|
TextComponent::text_string(
|
||||||
" ".to_owned().to_string()
|
" ".to_owned() + &"-".repeat((52 - header_text.len() - 3) / 2) + "\n",
|
||||||
+ &"-".repeat((52 - header_text.len() - 3) / 2)
|
|
||||||
+ "\n",
|
|
||||||
)
|
)
|
||||||
.color_named(NamedColor::Yellow),
|
.color_named(NamedColor::Yellow),
|
||||||
);
|
);
|
||||||
@ -201,18 +199,17 @@ impl CommandExecutor for BaseHelpExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let footer_text = format!(" Page {page}/{total_pages} ");
|
let footer_text = format!(" Page {page}/{total_pages} ");
|
||||||
|
|
||||||
message = message
|
message = message
|
||||||
.add_child(
|
.add_child(
|
||||||
TextComponent::text_string("-".repeat((52 - footer_text.len() - 3) / 2) + " ")
|
TextComponent::text_string("-".repeat((52 - footer_text.len() - 3) / 2) + " ")
|
||||||
.color_named(NamedColor::Yellow),
|
.color_named(NamedColor::Yellow),
|
||||||
)
|
)
|
||||||
.add_child(arrow_left)
|
.add_child(arrow_left)
|
||||||
.add_child(TextComponent::text_string(footer_text.clone()))
|
.add_child(TextComponent::text(&footer_text))
|
||||||
.add_child(arrow_right)
|
.add_child(arrow_right)
|
||||||
.add_child(
|
.add_child(
|
||||||
TextComponent::text_string(
|
TextComponent::text_string(
|
||||||
" ".to_owned().to_string() + &"-".repeat((52 - footer_text.len() - 3) / 2),
|
" ".to_owned() + &"-".repeat((52 - footer_text.len() - 3) / 2),
|
||||||
)
|
)
|
||||||
.color_named(NamedColor::Yellow),
|
.color_named(NamedColor::Yellow),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -14,7 +14,6 @@ use pumpkin_core::text::color::{Color, NamedColor};
|
|||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[allow(dead_code)]
|
|
||||||
pub(crate) enum CommandError {
|
pub(crate) enum CommandError {
|
||||||
/// This error means that there was an error while parsing a previously consumed argument.
|
/// This error means that there was an error while parsing a previously consumed argument.
|
||||||
/// That only happens when consumption is wrongly implemented, as it should ensure parsing may
|
/// That only happens when consumption is wrongly implemented, as it should ensure parsing may
|
||||||
@ -92,7 +91,7 @@ impl<'a> CommandDispatcher<'a> {
|
|||||||
let Some(key) = parts.next() else {
|
let Some(key) = parts.next() else {
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
};
|
};
|
||||||
let raw_args: Vec<&str> = parts.rev().collect();
|
let mut raw_args: Vec<&str> = parts.rev().collect();
|
||||||
|
|
||||||
let Ok(tree) = self.get_tree(key) else {
|
let Ok(tree) = self.get_tree(key) else {
|
||||||
return Vec::new();
|
return Vec::new();
|
||||||
@ -103,15 +102,8 @@ impl<'a> CommandDispatcher<'a> {
|
|||||||
// try paths and collect the nodes that fail
|
// try paths and collect the nodes that fail
|
||||||
// todo: make this more fine-grained
|
// todo: make this more fine-grained
|
||||||
for path in tree.iter_paths() {
|
for path in tree.iter_paths() {
|
||||||
match Self::try_find_suggestions_on_path(
|
match Self::try_find_suggestions_on_path(src, server, &path, tree, &mut raw_args, cmd)
|
||||||
src,
|
.await
|
||||||
server,
|
|
||||||
&path,
|
|
||||||
tree,
|
|
||||||
raw_args.clone(),
|
|
||||||
cmd,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
{
|
{
|
||||||
Err(InvalidConsumption(s)) => {
|
Err(InvalidConsumption(s)) => {
|
||||||
log::error!("Error while parsing command \"{cmd}\": {s:?} was consumed, but couldn't be parsed");
|
log::error!("Error while parsing command \"{cmd}\": {s:?} was consumed, but couldn't be parsed");
|
||||||
@ -137,7 +129,7 @@ impl<'a> CommandDispatcher<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut suggestions = Vec::from_iter(suggestions);
|
let mut suggestions = Vec::from_iter(suggestions);
|
||||||
suggestions.sort_by(|a, b| a.suggestion.cmp(&b.suggestion));
|
suggestions.sort_by(|a, b| a.suggestion.cmp(b.suggestion));
|
||||||
suggestions
|
suggestions
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,13 +145,13 @@ impl<'a> CommandDispatcher<'a> {
|
|||||||
let key = parts
|
let key = parts
|
||||||
.next()
|
.next()
|
||||||
.ok_or(GeneralCommandIssue("Empty Command".to_string()))?;
|
.ok_or(GeneralCommandIssue("Empty Command".to_string()))?;
|
||||||
let raw_args: Vec<&str> = parts.rev().collect();
|
let mut raw_args: Vec<&str> = parts.rev().collect();
|
||||||
|
|
||||||
let tree = self.get_tree(key)?;
|
let tree = self.get_tree(key)?;
|
||||||
|
|
||||||
// try paths until fitting path is found
|
// try paths until fitting path is found
|
||||||
for path in tree.iter_paths() {
|
for path in tree.iter_paths() {
|
||||||
if Self::try_is_fitting_path(src, server, &path, tree, raw_args.clone()).await? {
|
if Self::try_is_fitting_path(src, server, &path, tree, &mut raw_args).await? {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +185,7 @@ impl<'a> CommandDispatcher<'a> {
|
|||||||
server: &'a Server,
|
server: &'a Server,
|
||||||
path: &[usize],
|
path: &[usize],
|
||||||
tree: &CommandTree<'a>,
|
tree: &CommandTree<'a>,
|
||||||
mut raw_args: RawArgs<'a>,
|
raw_args: &mut RawArgs<'a>,
|
||||||
) -> Result<bool, CommandError> {
|
) -> Result<bool, CommandError> {
|
||||||
let mut parsed_args: ConsumedArgs = HashMap::new();
|
let mut parsed_args: ConsumedArgs = HashMap::new();
|
||||||
|
|
||||||
@ -213,7 +205,7 @@ impl<'a> CommandDispatcher<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NodeType::Argument { consumer, name, .. } => {
|
NodeType::Argument { consumer, name, .. } => {
|
||||||
match consumer.consume(src, server, &mut raw_args).await {
|
match consumer.consume(src, server, raw_args).await {
|
||||||
Some(consumed) => {
|
Some(consumed) => {
|
||||||
parsed_args.insert(name, consumed);
|
parsed_args.insert(name, consumed);
|
||||||
}
|
}
|
||||||
@ -236,7 +228,7 @@ impl<'a> CommandDispatcher<'a> {
|
|||||||
server: &'a Server,
|
server: &'a Server,
|
||||||
path: &[usize],
|
path: &[usize],
|
||||||
tree: &CommandTree<'a>,
|
tree: &CommandTree<'a>,
|
||||||
mut raw_args: RawArgs<'a>,
|
raw_args: &mut RawArgs<'a>,
|
||||||
input: &'a str,
|
input: &'a str,
|
||||||
) -> Result<Option<Vec<CommandSuggestion<'a>>>, CommandError> {
|
) -> Result<Option<Vec<CommandSuggestion<'a>>>, CommandError> {
|
||||||
let mut parsed_args: ConsumedArgs = HashMap::new();
|
let mut parsed_args: ConsumedArgs = HashMap::new();
|
||||||
@ -252,7 +244,7 @@ impl<'a> CommandDispatcher<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NodeType::Argument { consumer, name } => {
|
NodeType::Argument { consumer, name } => {
|
||||||
match consumer.consume(src, server, &mut raw_args).await {
|
match consumer.consume(src, server, raw_args).await {
|
||||||
Some(consumed) => {
|
Some(consumed) => {
|
||||||
parsed_args.insert(name, consumed);
|
parsed_args.insert(name, consumed);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user