Merge remote-tracking branch 'pr/754' into integ/mp-sh
This commit is contained in:
@@ -120,7 +120,7 @@ fn main() -> Result<()> {
|
||||
step("mesh tables");
|
||||
let collision = collisions::load(&root, assets.registry)?;
|
||||
step("collision");
|
||||
let motion = MotionResources::load(&root, &assets)?;
|
||||
let motion = MotionResources::load_with_facts(&root, &assets, &facts)?;
|
||||
step("motion");
|
||||
let terrain = VanillaTerrain::new(&root.join("worldgen"), assets.registry, &biomes, 1234)?;
|
||||
step("worldgen");
|
||||
|
||||
@@ -10538,7 +10538,7 @@ fn load_resources(
|
||||
on_stage(5);
|
||||
let registry_owner = assets.clone();
|
||||
let collision = collisions::load(&root, registry_owner.registry)?;
|
||||
let motion = MotionResources::load(&root, ®istry_owner)?;
|
||||
let motion = MotionResources::load_with_facts(&root, ®istry_owner, &facts)?;
|
||||
log::info!(
|
||||
"load collision+motion: {:.2}s",
|
||||
started.elapsed().as_secs_f32()
|
||||
|
||||
@@ -56,7 +56,22 @@ pub struct MotionResources {
|
||||
pub fluids: FluidResources,
|
||||
}
|
||||
impl MotionResources {
|
||||
/// [`Self::load_with_facts`] with the block facts decoded here.
|
||||
pub fn load(root: &Path, assets: &Assets) -> Result<Self> {
|
||||
Self::load_with_facts(
|
||||
root,
|
||||
assets,
|
||||
&crate::blocks::BlockFacts::load(root, assets.registry)?,
|
||||
)
|
||||
}
|
||||
/// The motion tables, with the block facts the game already decoded
|
||||
/// (decoding `gameplay-facts.json` again costs a second or more and, with
|
||||
/// a big modpack, hundreds of megabytes while it runs).
|
||||
pub fn load_with_facts(
|
||||
root: &Path,
|
||||
assets: &Assets,
|
||||
facts: &crate::blocks::BlockFacts,
|
||||
) -> Result<Self> {
|
||||
let attributes = Arc::new(Catalog::from_json(&serde_json::from_slice(&fs::read(
|
||||
root.join("attributes.json"),
|
||||
)?)?)?);
|
||||
@@ -85,7 +100,7 @@ impl MotionResources {
|
||||
Ok(Self {
|
||||
landing: crate::landing::load(root, &properties)?,
|
||||
health: crate::health::HealthResources::load(root)?,
|
||||
fluids: FluidResources::load(root, assets)?,
|
||||
fluids: FluidResources::new(assets, facts)?,
|
||||
attributes,
|
||||
blocks: properties.bind(&MovementTags {
|
||||
fences: tag("minecraft:fences")?,
|
||||
|
||||
@@ -33,8 +33,7 @@ pub struct FluidResources {
|
||||
pub shapes: Mutex<FluidShapeCache>,
|
||||
}
|
||||
impl FluidResources {
|
||||
pub fn load(root: &Path, assets: &Assets) -> Result<Self> {
|
||||
let facts = crate::blocks::BlockFacts::load(root, assets.registry)?;
|
||||
pub fn new(assets: &Assets, facts: &crate::blocks::BlockFacts) -> Result<Self> {
|
||||
Ok(Self {
|
||||
states: FluidStateTable::new(assets.registry)?,
|
||||
sturdy: facts.states.iter().map(|s| s.sturdy_full).collect(),
|
||||
|
||||
Reference in New Issue
Block a user