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



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

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 ['forge', 'fml'].include?(ident.artifact) && ['net.minecraftforge', 'cpw.mods'].include?(ident.group)
      mcversion = nil
      file.requires.each do |req|
        if req.uid == 'net.minecraft'
          mcversion = req.version
        end
      end
      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