Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.13/1.14/1.15/1.16 assets #71

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions blocks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ macro_rules! define_blocks {
Block::$name {
$($fname,)?
} => {
$(return String::from($variant);)?
"normal".to_owned()
$(return String::from($variant);)*
//"normal".to_owned()
"".to_owned()
}
)+
}
Expand Down Expand Up @@ -5258,7 +5259,7 @@ define_blocks! {
},
data Some(facing.horizontal_index()),
offset Some(facing.horizontal_offset()),
model { ("minecraft", "silver_glazed_terracotta") },
model { ("minecraft", "light_gray_glazed_terracotta") },
variant format!("facing={}", facing.as_string()),
}
CyanGlazedTerracotta {
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/steven/blockstates/missing_block.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"variants": {
"normal": { "model": "missing_block" }
"": { "model": "missing_block" }
}
}
22 changes: 17 additions & 5 deletions src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,23 @@ impl Factory {
{
Some(val) => val,
None => {
error!(
"Couldn't find model {}",
format!("models/block/{}.json", model_name)
);
return None;
// 1.13+ paths remove implicit blocks/
// TODO: remove fallback, look for specific asset version?
match self
.resources
.read()
.unwrap()
.open(plugin, &format!("models/{}.json", model_name))
{
Some(val) => val,
None => {
error!(
"Couldn't find model models/block/{}.json or models/{}.json",
model_name, model_name
);
return None;
}
}
}
};
let block_model: serde_json::Value = try_log!(opt serde_json::from_reader(file));
Expand Down
8 changes: 4 additions & 4 deletions src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ use std_or_web::fs;
use crate::types::hash::FNVHash;
use crate::ui;

const RESOURCES_VERSION: &str = "1.12.2";
const RESOURCES_VERSION: &str = "1.13.2";
const VANILLA_CLIENT_URL: &str =
"https://launcher.mojang.com/v1/objects/0f275bc1547d01fa5f56ba34bdc87d981ee12daf/client.jar";
const ASSET_VERSION: &str = "1.12";
const ASSET_INDEX_URL: &str = "https://launchermeta.mojang.com/mc/assets/1.12/67e29e024e664064c1f04c728604f83c24cbc218/1.12.json";
"https://launcher.mojang.com/v1/objects/30bfe37a8db404db11c7edf02cb5165817afb4d9/client.jar";
const ASSET_VERSION: &str = "1.13.1";
const ASSET_INDEX_URL: &str = "https://launchermeta.mojang.com/mc/assets/1.13.1/1e710e31f3ce2fe262373b8cf5e054ee5955d904/1.13.1.json";

pub trait Pack: Sync + Send {
fn open(&self, name: &str) -> Option<Box<dyn io::Read>>;
Expand Down