resource: remove "minecraft:" prefix from hash keys

Shorter keys mean less data to hash.
This commit is contained in:
Matthias Schiffer 2023-03-01 21:58:43 +01:00
parent 483cdf48c8
commit 95e4e45974
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
3 changed files with 941 additions and 940 deletions

View file

@ -35,7 +35,7 @@ with open(sys.argv[1]) as f:
output = {}
for name, info in blocks.items():
id = 'minecraft:' + name
id = name
output[id] = {
'color': {'r': 0, 'g': 0, 'b': 0},

File diff suppressed because it is too large Load diff

View file

@ -58,7 +58,8 @@ pub struct BlockTypeMap(HashMap<String, BlockType>);
impl BlockTypeMap {
#[inline]
pub fn get(&self, id: &str) -> Option<BlockType> {
self.0.get(id).copied()
let suffix = id.strip_prefix("minecraft:")?;
self.0.get(suffix).copied()
}
}