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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! Nanites (`docs/design/nanites.md`): the namespaces the game's names come
//! in, the host's mapping table, and the services reflection goes through.
names! {
/// The namespaces of the game's names.
mapping_ns {
/// Mojang's: what nanites name members by.
MOJANG = "mojang",
/// Fabric's run-time names (before 26.2).
INTERMEDIARY = "intermediary",
/// Forge's run-time member names.
SRG = "srg",
/// The game's own obfuscated names.
OFFICIAL = "official",
/// Loom's column of Mojang's names in its tiny file.
NAMED = "named",
}
/// The host's mapping table, in its jar.
mapping_file {
NAME = crate::concatcp!("yog-mappings", crate::sep::DOT, crate::Format::Data.ext()),
}
/// `yog:nanite/…`: reflection — a member resolved once, then called,
/// read or written by its handle.
service_nanite {
DOMAIN = crate::concatcp!(crate::service::PREFIX, crate::nanite_word::NANITE, crate::sep::PATH),
RESOLVE = crate::concatcp!(DOMAIN, "resolve"),
CALL = crate::concatcp!(DOMAIN, crate::bus_word::CALL),
GET = crate::concatcp!(DOMAIN, crate::bus_word::GET),
SET = crate::concatcp!(DOMAIN, crate::bus_word::SET),
RELEASE = crate::concatcp!(DOMAIN, crate::bus_word::RELEASE),
}
/// What a reference to an object the host holds for a mod is
/// (`yog_data::Ref`'s kind; its id the object's number).
nanite_ref {
OBJECT = crate::concatcp!(crate::ns::YOG, crate::sep::NAMESPACE, "object"),
}
/// The words nanites' names are made of.
nanite_word {
NANITE = "nanite",
}
/// `yog:event/nanite/…`: what nanites' injections emit.
event_nanite {
PLANE = crate::concatcp!(crate::event::PREFIX, crate::nanite_word::NANITE, crate::sep::PATH),
/// An injection point reached; keyed by the point.
INJECT = crate::concatcp!(PLANE, crate::nanite_kind::INJECT),
}
/// Where in a method an injection goes: Mixin's `@At` values.
mixin_at {
HEAD = "HEAD",
RETURN = "RETURN",
TAIL = "TAIL",
INVOKE = "INVOKE",
INVOKE_ASSIGN = "INVOKE_ASSIGN",
FIELD = "FIELD",
NEW = "NEW",
CONSTANT = "CONSTANT",
LOAD = "LOAD",
STORE = "STORE",
JUMP = "JUMP",
}
/// Mixin's `@At(shift)`.
mixin_shift {
NONE = "NONE",
BEFORE = "BEFORE",
AFTER = "AFTER",
}
/// What joins an injection point's parts in its key
/// (`<class>#<method><desc>@<at>`).
nanite_point {
MEMBER = crate::sep::TAG,
AT = crate::sep::TYPED,
TARGET = crate::sep::NAMESPACE,
/// A field redirect's write.
WRITE = "write",
}
/// What a nanite does at its point: Mixin's injectors.
nanite_kind {
/// `@Inject`: handlers see the point, may cancel or return.
INJECT = "inject",
/// `@Redirect` / `@WrapOperation`: handlers answer for a call (or
/// let it run, given the original).
REDIRECT = "redirect",
/// `@ModifyArg`: one argument of a call, changed.
MODIFY_ARG = "modify_arg",
/// `@ModifyVariable`: a local, changed.
MODIFY_VARIABLE = "modify_variable",
/// `@ModifyConstant`: a constant, changed.
MODIFY_CONSTANT = "modify_constant",
/// A field added to the class (`@Unique`), the mod's own.
ADD_FIELD = "add_field",
/// A method added to the class, its body the mod's handler.
ADD_METHOD = "add_method",
/// An interface the class is made to implement.
IMPLEMENT = "implement",
}
/// An added field's name: `yog$<crate>$<name>` (one a mod, no mapping).
nanite_added {
PREFIX = "yog$",
SEP = "$",
}
/// A `@ModifyConstant`'s constant: `<type>:<value>` (`int:5`, `null`).
nanite_constant {
INT = crate::word::INT,
FLOAT = crate::shape_kind::FLOAT,
LONG = "long",
DOUBLE = "double",
STRING = crate::word::STRING,
NULL = "null",
}
/// A local an inject asks for: `[&]<descriptor>[@<ordinal>]` — `&` to
/// write it too (MixinExtras' `LocalRef`), the ordinal among locals of
/// its type.
nanite_local {
REF = "&",
ORDINAL = crate::sep::TYPED,
/// What separates the locals in a declaration (`locals = "F, &I@1"`).
LIST = crate::sep::LIST,
}
}