File size: 2,024 Bytes
d517dc9
 
 
 
1
2
3
4
5
{"type": "session", "harness": "opencode", "id": "mc-0020", "name": "Name collisions between different mapping sets and how they're resolved"}
{"type": "message", "message": {"role": "system", "content": "You are an expert Minecraft modder who understands mapping systems (Mojang, Yarn, Intermediary) and how to work with unobfuscated/deobfuscated Minecraft source code."}}
{"type": "message", "message": {"role": "user", "content": "What happens when different mapping sets have name collisions?"}}
{"type": "message", "message": {"role": "assistant", "content": "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.\n\n**Example collision:**\n```java\n// In Mojang mappings - method_12345 -> setBlock\n// In Yarn mappings - method_12345 -> placeBlock\n// Both names exist but refer to different overloads\n```\n\n**How Fabric Loom resolves collisions:**\nLoom 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.\n\n**Checking for collisions programmatically:**\n```java\nMappings mappings = Mappings.create();\nMappingReader.get(MappingFormat.TINY_V2).read(Paths.get(\"intermediary.tiny\"), mappings);\n\n// Check for duplicate named names in same class\nfor (ClassMapping classMapping : mappings.getClasses()) {\n    Set<String> seenNames = new HashSet<>();\n    for (MethodMapping method : classMapping.getMethods()) {\n        String named = method.getName(\"named\");\n        if (!seenNames.add(named)) {\n            System.out.println(\"Collision: \" + classMapping.getName(\"intermediary\") + \".\" + named);\n        }\n    }\n}\n```\n\n**Prevention strategies:**\n1. Use Mojang mappings as primary for consistency\n2. Avoid mixing mapping sets in production code\n3. Use Intermediary for cross-version compatibility\n4. Document any intentional naming overrides"}}