-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmcmodfixes.py
153 lines (130 loc) · 4.86 KB
/
mcmodfixes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/usr/bin/python
# Fixes and mod-specific data for various mods' mcmod.info files
import fnmatch
DEP_BLACKLIST = set((
"mod_MinecraftForge", # we always have Forge
"Forge", # typo(?) for mod_MinecraftForge
"FML", # we always have FML
"MinecraftForge", # another typo for mod_MinecraftForge
"MinecraftForge, CodeChickenCore", # typo for CodeChickenCore, broken string instead of a real list
"MinecraftForge,CoFHCore", # typo for ["MinecraftForge","CoFHCore"]
"Industrialcraft", # typo for IC2
"GUI_Api", # typo for GuiAPI and not needed on server
"EurysCore", # replaced by SlimevoidLib?
"Modular Powersuits", # mmmPowersuits
"mod_NotEnoughItems", # chargepads
"mod_IC2", # MFFS
))
DEP_ADDITIONS = {
"MFFS": ["IC2"],
"gregtech": ["IC2"],
"dimensional-anchor": ["IC2"],
"MineFactoryReloaded": ["PowerCrystalsCore"],
"NetherOres": ["PowerCrystalsCore"],
"PowerConverters": ["PowerCrystalsCore"],
"FlatBedrock": ["PowerCrystalsCore"],
"immibis-microblocks": ["ImmibisCore"],
"SlopesAndCorners": ["SlimevoidLib"],
"ChickenChunks": ["CodeChickenCore"],
"EnderStorage": ["CodeChickenCore"],
"TrailMix": ["iChunUtil"],
"Torched": ["iChunUtil"],
"MPSA": ["mmmPowersuits"],
"ThermalExpansion": ["CoFHCore"],
"OmniTools": ["CoFHCore"],
"ElectricExpansion": ["BasicComponents"],
"OpenCCSensors": ["ComputerCraft"],
"Translocator": ["CodeChickenCore"],
"miscperipherals": ["ComputerCraft"],
"chargepads": ["NotEnoughItems"],
"MekanismGenerators": ["Mekanism"],
"MekanismTools": ["Mekanism"],
"thaumicbees": ["Forestry"],
"Galacticraft": ["IC2"], # requires IC2, UE, or TE - picked one: <strong><h1>Galacticraft Requires Basic Components, IndustrialCraft 2, or Thermal Expansion!</h1></strong><br /><h3>You can enable Basic Components loader in the Galacticraft config or install IndustrialCraft 2/Thermal Expansion manually</h3>
"extra-bees": ["Forestry"],
"PluginsforForestry": ["denLib", "Forestry", "ThermalExpansion"],
"DartCraft": ["IC2"],
}
MOD_IDS = {
"PowerCrystalsCore*": ["PowerCrystalsCore"],
"*bspkrsCore*": ["mod_bspkrsCore"], # newline in json, can't parse
"BasicComponents*": ["BasicComponents"], # no mcmod.info
"denLib*": ["denLib"], # no mcmod.info
"DartCraft*": ["DartCraft"], # no mcmod.info
}
FILENAME_HAS_NO_VERSION = [
"gregtechmod.zip", # "If you are unsure about your Version, look at the "mcmod.info" inside the zip, just open it with Notepad."
"WeaponMod.zip",
"Barrels 1.5+.jar",
"ArchimedesShips.zip",
]
REQUIRES_EXTRACTION = {
# mod name : extracted from this folder
"Millenaire": "Put in mods folder",
"BattleTowers": "mods",
"KenshiroMod": "mods",
"MagicYarn": "mods",
"Ruins": "mods",
#"RopePlus": "mods", # not
"BetterDungeons": "mods", # but also requires extra files .minecraft..
"Dynmap": "mods",
}
USES_UNSHIFTED_ITEM_IDS = [
"immibis-*",
]
# convert "name" on http://bot.notenoughmods.com/1.5.1.html to internal mod ID, when they don't match
NEM_TO_MODID = {
"bau5_ProjectBench": "ProjectBench",
"TheBarrelsMod": "barrels",
"Buildcraft": "BuildCraft|Core",
"CustomMobSpawner": "CustomSpawner",
"Mo'Creatures": "MoCreatures",
"EquivalentExchange3": "EE3",
"GravityGun": "GraviGun",
"GregTech": "GregTech_Addon",
"NuclearControl": "IC2NuclearControl",
"Immibis'sMicroblocks": "ImmibisMicroblocks",
"Immibis'sPeripherals": "u'ImmibisPeripherals",
"IndustrialCraft2": "IC2",
"IronChests": "IronChest",
"AdvancedSolarPanels": "AdvancedSolarPanel",
"ModularPowersuits": "mmmPowersuits",
"ModularPowersuits-Addons": "u'PowersuitAddons",
"NEIMystcraftPlugin": "NEI-Mystcraft-Plugin",
"TinkersConstruct": "TConstruct",
"EnchantingPlus": "eplus",
}
def getExtraDeps(mod):
for k, v in DEP_ADDITIONS.iteritems():
if mod.startswith(k):
return set(v)
return set()
def fixDeps(mod, deps):
deps = set(deps)
deps -= DEP_BLACKLIST
deps |= getExtraDeps(mod)
deps = [dep.split("@")[0] for dep in deps] # remove version constraints
return deps
def fixModIDs(mod, ids):
for k, v in MOD_IDS.iteritems():
if fnmatch.fnmatch(mod, k):
return v
return ids
def modNeedsRename(fn):
for k in FILENAME_HAS_NO_VERSION:
if fn.startswith(k):
return True
return False
"""Get the folder name in a mod zip which tells you to install it into the mod folders."""
def getInstructionFolder(fn):
for k, v in REQUIRES_EXTRACTION.iteritems():
if fn.startswith(k):
return v
return None
def usesUnshiftedItemIDs(fn):
for k in USES_UNSHIFTED_ITEM_IDS:
if fn.startswith(k):
return True
return False
def fixNotEnoughModsName(name):
return NEM_TO_MODID.get(name, name)