Skip to content

Commit f9f8005

Browse files
committed
Revert "Datapack parsing (feather-rs#455)"
This reverts commit 7e46ec7.
1 parent b5ccddf commit f9f8005

File tree

20 files changed

+20
-1391
lines changed

20 files changed

+20
-1391
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
.cargo
88

99
world/
10-
feather/downloaded
11-
feather/datapacks/minecraft/
1210
/config.toml
1311

1412
# Python cache files (libcraft)

Cargo.lock

Lines changed: 2 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

feather/blocks/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ impl BlockId {
9494
VANILLA_ID_TABLE[self.kind as u16 as usize][self.state as usize]
9595
}
9696

97+
/*
9798
/// Returns the vanilla fluid ID for this block in case it is a fluid.
9899
/// The fluid ID is used in the Tags packet.
99100
pub fn vanilla_fluid_id(self) -> Option<u16> {
@@ -111,6 +112,7 @@ impl BlockId {
111112
None
112113
}
113114
}
115+
*/
114116

115117
/// Returns the block corresponding to the given vanilla ID.
116118
///

feather/common/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@ uuid = { version = "0.8", features = [ "v4" ] }
2222
libcraft-core = { path = "../../libcraft/core" }
2323
rayon = "1.5"
2424
worldgen = { path = "../worldgen", package = "feather-worldgen" }
25-
datapacks = { path = "../datapacks", package = "feather-datapacks" }
2625
rand = "0.8"

feather/common/src/game.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::{cell::RefCell, mem, rc::Rc, sync::Arc};
22

33
use base::{BlockId, BlockPosition, ChunkPosition, Position, Text, Title};
4-
use datapacks::{RecipeRegistry, TagRegistry};
54
use ecs::{
65
Ecs, Entity, EntityBuilder, HasEcs, HasResources, NoSuchEntity, Resources, SysResult,
76
SystemExecutor,
@@ -55,10 +54,6 @@ pub struct Game {
5554
entity_spawn_callbacks: Vec<EntitySpawnCallback>,
5655

5756
entity_builder: EntityBuilder,
58-
59-
pub tag_registry: TagRegistry,
60-
61-
pub recipe_registry: RecipeRegistry,
6257
}
6358

6459
impl Default for Game {
@@ -79,8 +74,6 @@ impl Game {
7974
tick_count: 0,
8075
entity_spawn_callbacks: Vec::new(),
8176
entity_builder: EntityBuilder::new(),
82-
tag_registry: TagRegistry::new(),
83-
recipe_registry: RecipeRegistry::new(),
8477
}
8578
}
8679

feather/datapacks/Cargo.toml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
[package]
22
name = "feather-datapacks"
33
version = "0.1.0"
4-
authors = [ "koskja <[email protected]>", "caelunshun <[email protected]>" ]
4+
authors = [ "caelunshun <[email protected]>" ]
55
edition = "2018"
66

77
[dependencies]
88
ahash = "0.4"
9+
anyhow = "1"
910
log = "0.4"
1011
serde = { version = "1", features = [ "derive" ] }
1112
serde_json = "1"
1213
smartstring = { version = "0.2", features = [ "serde" ] }
1314
thiserror = "1"
14-
generated = { path = "../generated", package = "feather-generated" }
15-
blocks = { path = "../blocks", package = "feather-blocks"}
16-
protocol = { path = "../protocol", package = "feather-protocol" }
17-
walkdir = "2.3.2"
18-
19-
[build-dependencies]
20-
vanilla-assets = { path = "./vanilla_assets", package = "feather-vanilla-assets" }
21-
anyhow = "1"
15+
ureq = { version = "2", default-features = false, features = [ "tls" ] }
16+
zip = "0.5"

feather/datapacks/build.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

feather/datapacks/src/id.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,6 @@ impl NamespacedId {
2929
pub fn name(&self) -> &str {
3030
&self.name
3131
}
32-
33-
pub fn from_parts(namespace: &str, name: &str) -> Result<Self, ParseError> {
34-
let namespace = if namespace.is_empty() {
35-
DEFAULT_NAMESPACE
36-
} else {
37-
namespace
38-
};
39-
validate_namespace(namespace)?;
40-
validate_name(name)?;
41-
Ok(Self {
42-
namespace: SmartString::from(namespace),
43-
name: SmartString::from(name),
44-
})
45-
}
4632
}
4733

4834
/// Error returned when a namespaced ID was formatted incorrectly.

feather/datapacks/src/lib.rs

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,19 @@
66
//! This crate also downloads vanilla JARs and assets
77
//! at startup; see `download_vanilla_assets`.
88
9-
use std::path::Path;
10-
119
use ahash::AHashMap;
12-
use id::ParseError;
1310
use serde::Deserialize;
1411
use smartstring::{LazyCompact, SmartString};
1512

13+
mod vanilla;
14+
pub use vanilla::download_vanilla_assets;
15+
1616
mod id;
1717
pub use id::NamespacedId;
1818

19-
mod serde_helpers;
20-
pub(crate) use serde_helpers::*;
21-
22-
pub mod tag;
23-
use tag::LoopError;
24-
pub use tag::{TagRegistry, TagRegistryBuilder};
25-
26-
pub mod recipe;
27-
pub use recipe::RecipeRegistry;
28-
2919
/// The default namespace for resource locations (NamespacedIds).
3020
pub const DEFAULT_NAMESPACE: &str = "minecraft";
3121

32-
use thiserror::Error;
33-
#[derive(Error, Debug)]
34-
pub enum TagLoadError {
35-
#[error("invalid namespaced id: {0}")]
36-
Parse(#[from] ParseError),
37-
#[error(transparent)]
38-
Io(#[from] std::io::Error),
39-
#[error("io error: {0}")]
40-
WalkDir(#[from] walkdir::Error),
41-
#[error("loop detected when parsing tags: {0}")]
42-
FoundLoop(#[from] LoopError),
43-
#[error("invalid tag link: {0} references {1}")]
44-
InvalidLink(NamespacedId, NamespacedId),
45-
#[error("json parsing error: {0}")]
46-
Json(#[from] serde_json::Error),
47-
}
48-
#[derive(Error, Debug)]
49-
pub enum RecipeLoadError {
50-
#[error("invalid namespaced id: {0}")]
51-
Parse(#[from] ParseError),
52-
#[error(transparent)]
53-
Io(#[from] std::io::Error),
54-
#[error("json parsing error: {0}")]
55-
Json(#[from] serde_json::Error),
56-
}
57-
5822
/// The pack.mcmeta file at the root of a datapack.
5923
///
6024
/// Formatted with JSON.
@@ -69,23 +33,3 @@ pub struct Datapacks {
6933
/// The metadata of loaded packs. Keyed by the datapack name.
7034
_meta: AHashMap<SmartString<LazyCompact>, PackMeta>,
7135
}
72-
#[derive(Default)]
73-
pub struct Datapack {
74-
pub advancements: (),
75-
pub loot_tables: (),
76-
pub recipes: (),
77-
pub structures: (),
78-
pub tags: TagRegistry,
79-
}
80-
81-
impl Datapack {
82-
pub fn new() -> Self {
83-
Self {
84-
..Default::default()
85-
}
86-
}
87-
pub fn from_folder(dir: &Path) -> Self {
88-
assert!(dir.is_dir(), "not a directory");
89-
todo!()
90-
}
91-
}

0 commit comments

Comments
 (0)