Class: ForgeRemoveMinecraftSanitizer
- Inherits:
-
BaseSanitizer
- Object
- BaseSanitizer
- ForgeRemoveMinecraftSanitizer
- Defined in:
- lib/wonko_the_sane/input/forge_installer_profile_input.rb
Overview
Removes minecraft stuff (libraries, arguments etc.)
Class Method Summary collapse
Class Method Details
.sanitize(file) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/wonko_the_sane/input/forge_installer_profile_input.rb', line 58 def self.sanitize(file) return nil if file.uid == 'org.lwjgl' # remove lwjgl, it's managed by minecraft return file if file.uid != 'net.minecraftforge' mcversion = file.requires.find { |r| r.uid == 'net.minecraft' }.version rescue nil minecraft = Registry.instance.retrieve 'net.minecraft', mcversion if minecraft.nil? # if we can't find the wanted version on the first try we try reloading the list to see if we get something WonkoTheSane.lists.find { |l| l.artifact == 'net.minecraft' }.refresh minecraft = Registry.instance.retrieve 'net.minecraft', mcversion end if minecraft file.client.mainClass = nil if minecraft.client.mainClass == file.client.mainClass file.client.minecraftArguments = nil if minecraft.client.minecraftArguments == file.client.minecraftArguments file.client.assets = nil if minecraft.client.assets == file.client.assets file.client.downloads.reject! do |lib| minecraft.client.downloads.find { |mcLib| lib.name == mcLib.name } != nil end file.requires.reject! do |req| minecraft.requires.find { |mcReq| req == mcReq } != nil end else # don't know which version of minecraft this is, so we can't know which parts to eliminate end file end |