Class: ForgeFixJarSanitizer

Inherits:
BaseSanitizer show all
Defined in:
lib/wonko_the_sane/input/forge_installer_profile_input.rb

Class Method Summary collapse

Class Method Details

.sanitize(file) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/wonko_the_sane/input/forge_installer_profile_input.rb', line 39

def self.sanitize(file)
  file.client.downloads.map! do |lib|
    ident = WonkoTheSane::Util::MavenIdentifier.new(lib.name)
    ident.artifact = 'forge' if 'net.minecraftforge' == ident.group && 'minecraftforge' == ident.artifact
    if %w(forge fml).include?(ident.artifact) && %w(net.minecraftforge cpw.mods).include?(ident.group)
      mcversion = file.requires.find { |r| r.uid == 'net.minecraft' }.version rescue nil
      lib = lib.clone
      ident.classifier = 'universal'
      ident.version = "#{mcversion}-#{ident.version}" unless ident.version.start_with? "#{mcversion}"
      lib.name = ident.to_name
    end
    lib
  end
  file
end