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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! V1963 (1.14.2) — schematic-relevant subset of `V1963.java`.
//!
//! Ported: the ENTITY `minecraft:villager` converter that strips every gossip
//! of `Type == "golem"` from the `Gossips` list (V1963.java:15-32).
//!
//! VERSION = MCVersions.V1_14_2 = 1963.
//!
//! Implementation note: no rename helper fits this — it is a list filter, so it
//! is implemented inline with NbtMap/MapExt over the `Gossips` list (a list of
//! maps). `retain` is equivalent to Java's index walk that removes matching
//! entries.
//!
//! Nothing non-schematic is present in this version.
use super::super::loss::{report_loss, LossKind, Severity};
use super::super::registry::RegistryBuilder;
use super::super::types::{MapExt, ValueExt};
const VERSION: i32 = 1963;
pub fn register(reg: &mut RegistryBuilder) {
reg.entity.add_converter_for_id(
"minecraft:villager",
VERSION,
0,
Box::new(|data, _from, _to| {
if let Some(gossips) = data.get_list_mut("Gossips") {
gossips.retain(|gossip| {
gossip.as_compound_ref().and_then(|m| m.get_string("Type")) != Some("golem")
});
}
}),
);
// Reverse (new -> old): the forward converter (V1963.java:15-32) *deletes*
// every gossip whose `Type == "golem"` from the villager's `Gossips` list.
// Deletion is irreversible: modern data carries no record of which golem
// gossips (or their values) once existed, so there is no information to
// reconstruct them (rule 11 — modern data genuinely cannot determine the
// old value). Best-effort inverse is a no-op on the data; we only flag the
// loss for villagers that actually have a `Gossips` list (mirroring the
// forward guard, which returned early when `Gossips` was absent — those
// could never have lost a golem entry). LossKind::Other: this is a deleted
// gameplay list entry, not a flattening/component/rename/merge case.
reg.entity.add_reverse_converter_for_id(
"minecraft:villager",
VERSION,
0,
Box::new(|data, _from, _to| {
if data.get_list("Gossips").is_some() {
report_loss(
VERSION,
LossKind::Other,
Severity::Loss,
"villager golem-type gossips were stripped on upgrade and cannot be restored",
);
}
}),
);
}