1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! V1914 (18w48a) — schematic-relevant subset of `V1914.java`.
//!
//! TILE_ENTITY converter for `minecraft:chest`: the block-entity `LootTable`
//! `minecraft:chests/village_blacksmith` is rewritten to
//! `minecraft:chests/village/village_weaponsmith` (V1914.java:13-24). Java reads
//! `getString("LootTable")` (null when absent) and only rewrites on an exact
//! match.
//!
//! VERSION = MCVersions.V18W48A (1914).
use super::super::registry::RegistryBuilder;
use super::super::types::MapExt;
const VERSION: i32 = 1914;
pub fn register(reg: &mut RegistryBuilder) {
reg.tile_entity.add_converter_for_id(
"minecraft:chest",
VERSION,
0,
Box::new(|data, _from, _to| {
if data.get_string("LootTable") == Some("minecraft:chests/village_blacksmith") {
data.set_string("LootTable", "minecraft:chests/village/village_weaponsmith");
}
}),
);
// Reverse of V1914.java:13-24. The forward rewrites the chest `LootTable`
// `minecraft:chests/village_blacksmith` -> `.../village/village_weaponsmith`.
// Only this single value is remapped in this version, so the new value
// uniquely encodes the old one for real downgrades — exact inverse, lossless
// (bucket A, a value rename). Matches the NEW id `minecraft:chest` (unchanged).
reg.tile_entity.add_reverse_converter_for_id(
"minecraft:chest",
VERSION,
0,
Box::new(|data, _from, _to| {
if data.get_string("LootTable") == Some("minecraft:chests/village/village_weaponsmith")
{
data.set_string("LootTable", "minecraft:chests/village_blacksmith");
}
}),
);
}