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
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 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/wonko_the_sane/input/forge_installer_profile_input.rb', line 59 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 = nil file.requires.each do |req| if req.uid == 'net.minecraft' mcversion = req.version end end minecraft = Registry.instance.retrieve 'net.minecraft', mcversion if not minecraft # 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.each do |list| list.refresh if list.artifact == 'net.minecraft' end 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.select! do |lib| nil == minecraft.client.downloads.find do |mcLib| lib.name == mcLib.name end end file.requires.select! do |req| if minecraft.requires nil == minecraft.requires.find do |mcReq| req == mcReq end else true end end else # don't know which version of minecraft this is, so we can't know which parts to eliminate end file end |