public static void handleMappings(FMLMissingMappingsEvent event) { for (MissingMapping mapping : event.getAll()) { if (EnderIO.DOMAIN.equals(mapping.resourceLocation.getResourceDomain())) { final String resourcePath = mapping.resourceLocation.getResourcePath(); if ("blockEnderIo".equals(resourcePath)) { mapping.ignore(); } else if (mapping.type == Type.BLOCK && "blockConduitFacade".equals(resourcePath)) { mapping.ignore(); } else if (mapping.type == Type.ITEM && "blockConduitFacade".equals(resourcePath)) { mapping.remap(ModObject.itemConduitFacade.getItem()); } else { try { ModObject modObject = ModObject.valueOf(resourcePath.replaceAll("([A-Z])", "_$0").toLowerCase(Locale.ENGLISH)); if (mapping.type == Type.BLOCK && modObject.getBlock() != null) { mapping.remap(modObject.getBlockNN()); } else if (mapping.type == Type.ITEM && modObject.getItem() != null) { mapping.remap(modObject.getItemNN()); } } catch (Exception e) { } } } } }
@EventHandler public void handleFzPrefixStrip(FMLMissingMappingsEvent event) { Map<String, Item> fixups = Registry.nameCleanup; for (MissingMapping missed : event.get()) { if (missed.type != GameRegistry.Type.ITEM) continue; Item target = fixups.get(missed.name); if (target != null) { missed.remap(target); } } }
@EventHandler public void replaceDerpyNames(FMLMissingMappingsEvent event) { // NORELEASE: Can remove in 1.8 Object[][] corrections = new Object[][] { {"factorization:tile.null", Core.registry.legacy_factory_block}, {"factorization:FZ factory", Core.registry.legacy_factory_block}, {"factorization:tile.factorization.ResourceBlock", Core.registry.resource_block}, {"factorization:FZ resource", Core.registry.resource_block}, {"factorization:tile.lightair", Core.registry.lightair_block}, {"factorization:FZ Lightair", Core.registry.lightair_block}, {"factorization:tile.factorization:darkIronOre", Core.registry.dark_iron_ore}, {"factorization:FZ dark iron ore", Core.registry.dark_iron_ore}, {"factorization:tile.bedrock", Core.registry.fractured_bedrock_block}, {"factorization:FZ fractured bedrock", Core.registry.fractured_bedrock_block}, {"factorization:tile.factorization:darkIronOre", Core.registry.dark_iron_ore}, {"factorization:FZ fractured bedrock", Core.registry.fractured_bedrock_block}, }; HashMap<String, Block> corr = new HashMap<String, Block>(); for (Object[] pair : corrections) { corr.put((String) pair[0], (Block) pair[1]); } for (MissingMapping missed : event.get()) { Block value = corr.get(missed.name); if (value == null) { continue; } if (missed.type == Type.BLOCK) { missed.remap(value); } else if (missed.type == Type.ITEM) { Item it = DataUtil.getItem(value); if (it != null) { missed.remap(it); } } } }