Utilizing the <Import> element to have incremental updates

As I’m sure you’ve seen, most packs start with an <Import>  element that adds Forge and its dependencies to a pack…  But did you know that all it does is import from another <Server>  element either in the same file or from a different one?  Today I’m going to show you how to set up your pack to allow you to do incremental updates.

To start with, I will show you an example from my own server:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="ServerPack.xsl" type="text/xsl" ?>
<ServerPack version="3.3" xmlns="http://www.mcupdater.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mcupdater.com http://files.mcupdater.com/ServerPackv2.xsd">
	<Server id="lunaa1710-redux" name="Lunatics Anonymous" newsUrl="http://files.mcupdater.com/lunaa1710-redux/news.html" version="1.7.10" mainClass="net.minecraft.launchwrapper.Launch" serverAddress="smbarbour.no-ip.biz" revision="R1" autoConnect="false">
		<Import url="http://files.mcupdater.com/example/forge.php?mc=1.7.10&amp;forge=10.13.4.1481">forge</Import>
		<Import url="http://files.mcupdater.com/optional/ServerPack.xml">optional</Import>
		<Import url="http://files.mcupdater.com/lunaa1710-redux/05312015.xml">05-31-2015</Import>
		<Import url="http://files.mcupdater.com/lunaa1710-redux/06102015.xml">06-10-2015</Import>
		<Import url="http://files.mcupdater.com/lunaa1710-redux/06162015.xml">06-16-2015</Import>
		<Import url="http://files.mcupdater.com/lunaa1710-redux/06192015.xml">06-19-2015</Import>
		<Import url="http://files.mcupdater.com/lunaa1710-redux/07102015.xml">07-10-2015</Import>
		<Import url="http://files.mcupdater.com/lunaa1710-redux/configs.xml">configs</Import>
	</Server>
</ServerPack>

At first, you can see that it has the standard Forge import, but then you’ll see that there are no <Module> entries in the main file of the pack.  It’s important to note that <Import> elements are processed in the order that they appear in the file and will be processed before <Module> elements.  This system relies on a mechanic of how MCUpdater handles the mod list:  There can only be one entry in the list per ID and adding a new mod with the same ID will replace the existing one.  The “optional” ServerPack is a more generic pack so we will skip over it, but the reason it is listed above the others is so that should the pack need to replace a mod from the optional pack, it will be able to.  This brings us to the first actual entry of the pack: <Import url=”http://files.mcupdater.com/lunaa1710-redux/05312015.xml”>05-31-2015</Import> which contains the following:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="ServerPack.xsl" type="text/xsl" ?>
<ServerPack version="3.3" xmlns="http://www.mcupdater.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mcupdater.com http://files.mcupdater.com/ServerPackv2.xsd">
	<Server id="05-31-2015" name="Lunatics Anonymous" version="1.7.10" revision="R1" autoConnect="false" abstract="true">
		<Module name="Advanced Generators" id="advgenerators" depends="" side="BOTH">
			<URL priority="0">http://files.mcupdater.com/lunaa1710-redux/mods/generators-mc1710-0.9.12.64.jar</URL>
			<Size>1048526</Size>
			<Required>true</Required>
			<ModType>Regular</ModType>
			<MD5>a7c2a9f9a7f8eef5f2333988e5009a36</MD5>
			<Meta>
				<credits></credits>
				<description></description>
				<version>0.9.12.64</version>
				<url>http://bdew.net/</url>
				<authors>bdew</authors>
			</Meta>
		</Module>
		<Module name="AE2 Stuff" id="ae2stuff" depends="" side="BOTH">
			<URL priority="0">http://files.mcupdater.com/lunaa1710-redux/mods/ae2stuff-0.2.1.22-mc1.7.10.jar</URL>
			<Size>161300</Size>
			<Required>true</Required>
			<ModType>Regular</ModType>
			<MD5>2943da8427818fa26a5286e3d7e0009e</MD5>
			<Meta>
				<credits></credits>
				<description></description>
				<version>0.2.1.22</version>
				<url>bdew.net</url>
				<authors>bdew</authors>
			</Meta>
		</Module>
<!-- Truncated for sanity -->
		<Module name="Treecapitator" id="Treecapitator" depends="bspkrsCore" side="BOTH">
			<URL priority="0">http://files.mcupdater.com/lunaa1710-redux/mods/[1.7.10]Treecapitator-universal-2.0.5b.jar</URL>
			<Size>100241</Size>
			<Required>true</Required>
			<ModType>Regular</ModType>
			<MD5>7c95eb0c8a941f46753c11439297a754</MD5>
			<Meta>
				<credits>Original by DaftPVF; additional credit to Lunatrius, AtomicStryker, ScottKillen</credits>
				<description>Allows you to chop down entire trees by breaking a single log.</description>
				<version>2.0.5b</version>
				<url>http://www.minecraftforum.net/topic/1009577-/</url>
				<authors>DaftPVF, bspkrs</authors>
			</Meta>
		</Module>
		<Module name="Zetta Industries" id="zettaindustries" depends="" side="BOTH">
			<URL priority="0">http://files.mcupdater.com/lunaa1710-redux/mods/zettaindustries-0.2a.jar</URL>
			<Size>582264</Size>
			<Required>true</Required>
			<ModType>Regular</ModType>
			<MD5>bee404e63dd46eb0145fc7926d04322a</MD5>
			<Meta>
				<credits>Code: marcin212, Graphic:Barlots</credits>
				<description></description>
				<version>0.2a</version>
				<url>http://www.bymarcin.com</url>
				<authors>marcin212</authors>
			</Meta>
		</Module>
	</Server>
</ServerPack>

You may notice something interesting about this list…  there are no <ConfigFile> entries.  Those are added later, which I will get to soon.  This is the initial pack definition, and will most likely be the longest XML in your pack.  Now I’ll show you the first update that was made <Import url=”http://files.mcupdater.com/lunaa1710-redux/06102015.xml”>06-10-2015</Import> which contains:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="ServerPack.xsl" type="text/xsl" ?>
<ServerPack version="3.3" xmlns="http://www.mcupdater.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mcupdater.com http://files.mcupdater.com/ServerPackv2.xsd">
	<Server id="06-10-2015" name="Update June 10th, 2015" newsUrl="about:blank" version="1.7.10" mainClass="net.minecraft.launchwrapper.Launch" revision="1" autoConnect="true">
		<Module name="Advanced Generators" id="advgenerators" depends="" side="BOTH">
			<URL priority="0">http://files.mcupdater.com/lunaa1710-redux/update-06102015/generators-0.9.14.79-mc1.7.10.jar</URL>
			<Size>1234280</Size>
			<Required>true</Required>
			<ModType>Regular</ModType>
			<MD5>e475bce2ecf91f5dc2ab9f01d656a414</MD5>
			<Meta>
				<credits></credits>
				<description></description>
				<version>0.9.14.79</version>
				<url>http://bdew.net/</url>
				<authors>bdew</authors>
			</Meta>
		</Module>
		<Module name="AE2 Stuff" id="ae2stuff" depends="" side="BOTH">
			<URL priority="0">http://files.mcupdater.com/lunaa1710-redux/update-06102015/ae2stuff-0.3.2.36-mc1.7.10.jar</URL>
			<Size>296565</Size>
			<Required>true</Required>
			<ModType>Regular</ModType>
			<MD5>5f97e512b8b3cf19ae5e775fee3fa6cb</MD5>
			<Meta>
				<credits></credits>
				<description></description>
				<version>0.3.2.36</version>
				<url>bdew.net</url>
				<authors>bdew</authors>
			</Meta>
		</Module>
<!-- Truncated for sanity -->
		<Module name="Solar Flux" id="SolarFlux" depends="" side="BOTH">
			<URL priority="0">http://files.mcupdater.com/lunaa1710-redux/update-06102015/SolarFlux-1.7.10-0.7.jar</URL>
			<Size>100669</Size>
			<Required>true</Required>
			<ModType>Regular</ModType>
			<MD5>9eb96f448305bf87164f9d46bf679acb</MD5>
			<Meta>
				<credits></credits>
				<description>Solar Panels producing Redstone Flux</description>
				<version>1.7.10-0.7</version>
				<url></url>
				<authors>Nauktis</authors>
			</Meta>
		</Module>
		<Module name="Zetta Industries" id="zettaindustries" depends="" side="BOTH">
			<URL priority="0">http://files.mcupdater.com/lunaa1710-redux/update-06102015/zettaindustries-0.2b.jar</URL>
			<Size>581920</Size>
			<Required>true</Required>
			<ModType>Regular</ModType>
			<MD5>4d4b73e9d0957f0cafcaf2fd880cb8e4</MD5>
			<Meta>
				<credits>Code: marcin212, Graphic:Barlots</credits>
				<description></description>
				<version>0.2b</version>
				<url>http://www.bymarcin.com</url>
				<authors>marcin212</authors>
			</Meta>
		</Module>
	</Server>
</ServerPack>

This list is much shorter and contains only the mods that have been updated.  I’ll spare you the details of the other updates.  The final <Import> element is the configs:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="ServerPack.xsl" type="text/xsl" ?>
<ServerPack version="3.3" xmlns="http://www.mcupdater.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mcupdater.com http://files.mcupdater.com/ServerPackv2.xsd">
	<Server id="configs" name="Lunatics Anonymous" version="1.7.10" revision="R1" abstract="true">
		<Module name="Advanced Generators" id="advgenerators" depends="" side="BOTH">
			<Required>true</Required>
			<ModType>Override</ModType>
			<ConfigFile>
				<URL>http://files.mcupdater.com/lunaa1710-redux/config/AdvGenerators/client.config</URL>
				<Path>config/AdvGenerators/client.config</Path>
				<NoOverwrite>true</NoOverwrite>
				<MD5>fad6aa998d64c2ad46e9bea3f06514ff</MD5>
			</ConfigFile>
			<ConfigFile>
				<URL>http://files.mcupdater.com/lunaa1710-redux/config/AdvGenerators/readme.txt</URL>
				<Path>config/AdvGenerators/readme.txt</Path>
				<NoOverwrite>false</NoOverwrite>
				<MD5>63bcba4e2c7ce2bc67fc6caf1d7ef8fc</MD5>
			</ConfigFile>
		</Module>
		<Module name="AE2 Stuff" id="ae2stuff" depends="" side="BOTH">
			<Required>true</Required>
			<ModType>Override</ModType>
			<ConfigFile>
				<URL>http://files.mcupdater.com/lunaa1710-redux/config/AE2Stuff/readme.txt</URL>
				<Path>config/AE2Stuff/readme.txt</Path>
				<NoOverwrite>false</NoOverwrite>
				<MD5>63bcba4e2c7ce2bc67fc6caf1d7ef8fc</MD5>
			</ConfigFile>
		</Module>
<!-- Truncated for sanity -->
		<Module name="Zetta Industries" id="zettaindustries" depends="" side="BOTH">
			<Required>true</Required>
			<ModType>Override</ModType>
			<ConfigFile>
				<URL>http://files.mcupdater.com/lunaa1710-redux/config/zettaindustries.cfg</URL>
				<Path>config/zettaindustries.cfg</Path>
				<NoOverwrite>false</NoOverwrite>
				<MD5>1ad72bfe4f9e40c1a1b4ad8e135b7303</MD5>
			</ConfigFile>
		</Module>
		<Module name="Minecraft Forge" id="forge-10.13.4.1481" depends="" side="BOTH">
			<Required>true</Required>
			<ModType order="1">Override</ModType>
			<ConfigFile>
				<URL>http://files.mcupdater.com/lunaa1710-redux/config/forgeChunkLoading.cfg</URL>
				<Path>config/forgeChunkLoading.cfg</Path>
				<NoOverwrite>false</NoOverwrite>
				<MD5>68637513d7bb3a2f8528d6fbf427d7d6</MD5>
			</ConfigFile>
			<ConfigFile>
				<URL>http://files.mcupdater.com/lunaa1710-redux/config/forge.cfg</URL>
				<Path>config/forge.cfg</Path>
				<NoOverwrite>false</NoOverwrite>
				<MD5>3a350b0930cb3df79b2e90f5c73d2f3d</MD5>
			</ConfigFile>
		</Module>
	</Server>
</ServerPack>

This one is slightly different.  All of the <Module> elements are <ModType>Override</ModType> this type will modify the existing entry for a ModID instead of replacing it entirely.  By doing this, no matter how many times a mod has been updated over the course of the server, the configs will only be specified once.

Now, the question you may ask yourself is “Why would I do this?”  The reasons that I have come up with are:  1) It provides a relatively clear changelog, and 2) Should something go wrong with a mod in an update, you can simply remove that entry from the update’s XML and the pack will revert to the previous version of the mod.

I originally did the splitting of the mods and configs by hand, but as of FastPack 1.6.11, this can be done automatically.

This is the staging area that I use for my own pack:

sbarbour@Redstone:~/staging/lunaa1710-redux$ tree
.
├── client
│   ├── [1.7.10]ArmorStatusHUD-client-1.28.jar
│   ├── [1.7.10]DamageIndicatorsMod-3.2.3.jar
│   ├── [1.7.10]StatusEffectHUD-client-1.27.jar
│   ├── InGameInfoXML-1.7.10-2.8.1.80-universal.jar
│   ├── JourneyMap5.0.1_Unlimited_MC1.7.10.jar
│   ├── LunatriusCore-1.7.10-1.1.2.21-universal.jar
│   └── Waila-1.5.10_1.7.10.jar
├── config
│   ├── AdvGenerators
│   │   ├── client.config
│   │   ├── overrides
│   │   └── readme.txt
│   ├── AE2Stuff
│   │   ├── overrides
│   │   └── readme.txt
... Several lines later
│   ├── Treecapitator.cfg
│   ├── Waila.cfg
│   └── zettaindustries.cfg
├── mods
│   ├── 1.7.10
│   │   ├── [1.7.10]bspkrsCore-universal-6.16.jar
│   │   └── ForgeMultipart-1.7.10-1.2.0.344-universal.jar
│   ├── [1.7.10]Treecapitator-universal-2.0.5b.jar
│   ├── ae2stuff-0.2.1.22-mc1.7.10.jar
│   ├── AgriCraft-1.7.10-1.3.1.jar
│   ├── appliedenergistics2-rv2-stable-3.jar
│   ├── autopackager-1.5.4.jar
... Several lines later
│   ├── zettaindustries-0.2a.jar
│   └── zz-backpacks 1.7.10 - 3.0.3.jar
├── optional
│   ├── CodeChickenCore-1.7.10-1.0.6.44-universal.jar
│   └── NotEnoughItems-1.7.10-1.0.4.107-universal.jar
├── server
│   ├── Dynmap-2.1-forge-1.7.10.jar
│   ├── IvToolkit-1.2.jar
│   ├── Morpheus-1.7.10-1.6.4.jar
│   └── RecurrentComplex-0.9.6.2.jar
├── update-06162015
│   ├── buildcraft-7.0.11.jar
│   ├── buildcraft-compat-7.0.8.jar
│   ├── generators-0.9.14-DEV-mc1.7.10.jar
│   └── rftools-3.02.jar
├── update-06192015
    ├── Chisel2-2.3.10.686e081.jar
    ├── DynamicTransport-0.1.2.0-custom.jar
    ├── SlimevoidLibrary-2.0.4.6.jar
    └── SolarFlux-1.7.10-0.8.jar

When you are first setting this up, you won’t have the update folders.  You would use FastPack somewhat like this:

java -jar ~/Downloads/MCU-FastPack-1.6.11.jar --path /home/sbarbour/staging/lunaa1710-redux --baseURL http://files.mcupdater.com/lunaa1710-redux --mc 1.7.10 --out /home/sbarbour/base.xml --id base --noConfigs

This will create the XML with the mods without the <ConfigFile> entries.  Then you would do something like this:

java -jar ~/Downloads/MCU-FastPack-1.6.11.jar --path /home/sbarbour/staging/lunaa1710-redux --baseURL http://files.mcupdater.com/lunaa1710-redux --mc 1.7.10 --out /home/sbarbour/configs.xml --id configs --configsOnly

This will create the XML with overrides that have the <ConfigFile> entries.  Then you would assemble a new XML like this:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="ServerPack.xsl" type="text/xsl" ?>
<ServerPack version="3.3" xmlns="http://www.mcupdater.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mcupdater.com http://files.mcupdater.com/ServerPackv2.xsd">
	<Server id="lunaa1710-redux" name="Lunatics Anonymous" newsUrl="http://files.mcupdater.com/lunaa1710-redux/news.html" version="1.7.10" mainClass="net.minecraft.launchwrapper.Launch" serverAddress="smbarbour.no-ip.biz" revision="R1" autoConnect="false">
		<Import url="http://files.mcupdater.com/example/forge.php?mc=1.7.10&amp;forge=10.13.4.1481">forge</Import>
		<Import url="http://files.mcupdater.com/lunaa1710-redux/base.xml">base</Import>
		<Import url="http://files.mcupdater.com/lunaa1710-redux/configs.xml">configs</Import>
	</Server>
</ServerPack>

This is your basic pack at this point and no updates have been made yet.

When it is time for your updates, you would create a new folder and place all of the updated mods in it. Then you would run FastPack like this:

java -jar ~/Downloads/MCU-FastPack-1.6.11.jar --path /home/sbarbour/staging/lunaa1710-redux/update-07102015 --baseURL http://files.mcupdater.com/lunaa1710-redux/update-07102015 --mc 1.7.10 --out /home/sbarbour/07102015.xml --id 07-10-2015

Now you would modify the XML above so that you would have this:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="ServerPack.xsl" type="text/xsl" ?>
<ServerPack version="3.3" xmlns="http://www.mcupdater.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mcupdater.com http://files.mcupdater.com/ServerPackv2.xsd">
	<Server id="lunaa1710-redux" name="Lunatics Anonymous" newsUrl="http://files.mcupdater.com/lunaa1710-redux/news.html" version="1.7.10" mainClass="net.minecraft.launchwrapper.Launch" serverAddress="smbarbour.no-ip.biz" revision="R1" autoConnect="false">
		<Import url="http://files.mcupdater.com/example/forge.php?mc=1.7.10&amp;forge=10.13.4.1481">forge</Import>
		<Import url="http://files.mcupdater.com/lunaa1710-redux/base.xml">base</Import>
		<Import url="http://files.mcupdater.com/lunaa1710-redux/07102015.xml">07-10-2015</Import>
		<Import url="http://files.mcupdater.com/lunaa1710-redux/configs.xml">configs</Import>
	</Server>
</ServerPack>

If your updates will need new configs, they can be added/updated in the original configs folder and FastPack can be run again as above to generate a new configs.xml file.  This assumes that you are making subfolders for your updates (as I did above).

If when you are updating, you actually want to remove a mod that was previously in the pack, you will need to modify the XML for the update by hand and create a <Module> entry with <ModType>Removal</ModType>

If you have any questions, you can always ask them in the #MCUpdater channel on Espernet IRC.