tinycodinglm / mc /mc-0020.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame Contribute Delete
2.02 kB
opencode trace
System You are an expert Minecraft modder who understands mapping systems (Mojang, Yarn, Intermediary) and how to work with unobfuscated/deobfuscated Minecraft source code.

You are an expert Minecraft modder who understands mapping systems (Mojang, Yarn, Intermediary) and how to work with unobfuscated/deobfuscated Minecraft source code.

User

What happens when different mapping sets have name collisions?

Assistant

Name collisions occur when different mapping sets assign the same name to different members. This is common because Mojang, Yarn, and MCP all use different naming conventions.

Example collision:

java
// In Mojang mappings - method_12345 -> setBlock
// In Yarn mappings - method_12345 -> placeBlock
// Both names exist but refer to different overloads

How Fabric Loom resolves collisions:
Loom uses the mapping hierarchy - when you specify loom.officialMojangMappings(), Mojang names take priority. Yarn names are only used as fallback when no Mojang name exists.

Checking for collisions programmatically:

java
Mappings mappings = Mappings.create();
MappingReader.get(MappingFormat.TINY_V2).read(Paths.get("intermediary.tiny"), mappings);

// Check for duplicate named names in same class
for (ClassMapping classMapping : mappings.getClasses()) {
    Set<String> seenNames = new HashSet<>();
    for (MethodMapping method : classMapping.getMethods()) {
        String named = method.getName("named");
        if (!seenNames.add(named)) {
            System.out.println("Collision: " + classMapping.getName("intermediary") + "." + named);
        }
    }
}

Prevention strategies:

  1. Use Mojang mappings as primary for consistency
  2. Avoid mixing mapping sets in production code
  3. Use Intermediary for cross-version compatibility
  4. Document any intentional naming overrides