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
61
62
//! V3093 (22w17a) — schematic-relevant subset of `V3093.java`.
//!
//! Kept: the ENTITY `minecraft:goat` converter, which sets `HasLeftHorn` and
//! `HasRightHorn` to `true` (goats gained two-horn state in 22w17a).
//!
//! VERSION = MCVersions.V22W17A = 3093.
use super::super::loss::{report_loss, LossKind, Severity};
use super::super::registry::RegistryBuilder;
use super::super::types::MapExt;
const VERSION: i32 = 3093;
pub fn register(reg: &mut RegistryBuilder) {
reg.entity.add_converter_for_id(
"minecraft:goat",
VERSION,
0,
Box::new(|data, _from, _to| {
data.set_bool("HasLeftHorn", true);
data.set_bool("HasRightHorn", true);
}),
);
// Reverse: bucket D (additive default). 22w17a added the two-horn booleans;
// pre-3093 goats had no `HasLeftHorn`/`HasRightHorn`. The forward sets both to
// `true` unconditionally, so drop them when they equal that default — lossless
// for genuine downgrades (the old format never carried these fields).
reg.entity.add_reverse_converter_for_id(
"minecraft:goat",
VERSION,
0,
Box::new(|data, _from, _to| {
for key in ["HasLeftHorn", "HasRightHorn"] {
match data.get_bool(key) {
Some(true) => {
data.take(key);
}
Some(false) => {
data.take(key);
report_loss(
VERSION,
LossKind::UnsupportedInTarget,
Severity::Loss,
format!("goat {key}=false has no representation before 3093; horn state dropped"),
);
}
None if data.has_key(key) => {
data.take(key);
report_loss(
VERSION,
LossKind::UnsupportedInTarget,
Severity::Loss,
format!("goat {key} is not a boolean and has no representation before 3093; dropped"),
);
}
None => {}
}
}
}),
);
}