As the tool name, this tool will generate a .yml file from a input official Mojang mappings file. This tool is very helpful for developers to manipulate NMS object using Mojang offical Mappings via Reflect or Handle.
Exported file is just like this:
Format is defined in README.MD in github project.
And here is a sample usage in my library CrescentLib(
https://github.com/awa-crescent/CrescentLib)
Code (Java):
public
abstract
class MappingsEntry
{
private
static YamlConfiguration mappings_entries
;
static
{
mappings_entries
=
new YamlConfiguration
(
)
;
InputStream mappings_stream
;
try
{
mappings_stream
= MappingsEntry.
class.
getClassLoader
(
).
getResource
(
"lib/crescent/nms/Mappings.yml"
).
openStream
(
)
;
if
(mappings_stream
==
null
)
{
Bukkit.
getLogger
(
).
log
(Level.
SEVERE,
"Cannot find embeded mappings file"
)
;
}
InputStreamReader mappings_stream_reader
=
new
InputStreamReader
(mappings_stream
)
;
mappings_entries.
load
(mappings_stream_reader
)
;
mappings_stream_reader.
close
(
)
;
mappings_stream.
close
(
)
;
}
catch
(
IOException
| InvalidConfigurationException ex
)
{
Bukkit.
getLogger
(
).
log
(Level.
SEVERE,
"Parsing mappings file failed", ex
)
;
}
}
public
static
String getObfuscatedName
(
String mojang_name
)
{
return mappings_entries.
getString
(mojang_name
)
;
}
}