Configurified the Meteor Ritual - Modpacks and users can edit all of the major properties of the meteor ritual, including what items need to be dropped onto the ritual as well as what you get in the ritual, radius, etc. The config will refresh if there is a version change unless you set "resyncOnVersionChange" to false.

This commit is contained in:
WayofTime 2016-09-09 12:28:23 -04:00
parent 63febfeb85
commit 4c79a4f2ff
8 changed files with 199 additions and 31 deletions

View file

@ -1,21 +1,27 @@
package WayofTime.bloodmagic;
import WayofTime.bloodmagic.annot.Handler;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.util.Utils;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.Getter;
import net.minecraft.block.Block;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.oredict.OreDictionary;
import java.io.File;
import java.util.*;
import WayofTime.bloodmagic.annot.Handler;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.ModMeteors;
import WayofTime.bloodmagic.util.Utils;
@Handler
public class ConfigHandler
@ -159,8 +165,18 @@ public class ConfigHandler
public static void syncConfig()
{
boolean configVersionChanged = false;
String category;
category = "Version";
Property prop = config.get(category, "Config Version", Constants.Mod.VERSION);
if (!prop.getString().equals(Constants.Mod.VERSION))
{
configVersionChanged = true;
prop.setValue(Constants.Mod.VERSION);
}
category = "Item/Block Blacklisting";
config.addCustomCategoryComment(category, "Allows disabling of specific Blocks/Items.\nNote that using this may result in crashes. Use is not supported.");
config.setCategoryRequiresMcRestart(category, true);
@ -303,6 +319,22 @@ public class ConfigHandler
thaumcraftGogglesUpgrade = config.getBoolean("thaumcraftGogglesUpgrade", category + ".thaumcraft", true, "Allows the Living Helmet to be upgraded with Goggles of Revealing in an Anvil.");
ignoreCompressionSpamAddedByCompression = config.getBoolean("ignoreCompressionSpamAddedByCompression", category + ".compression", true, "Compression decided to add a storage recipe for every item and block in the game. This will make the Sigil of Compression ignore those recipes so your game will actually load in a decent amount of time.");
category = "Meteors";
config.addCustomCategoryComment(category, "Meteor settings");
String[] defaultMeteors = ModMeteors.getDefaultMeteors();
boolean resyncMeteorOnVersionChange = config.getBoolean("resyncOnVersionChange", category, true, "");
Property meteorsProp = config.get(category, "MeteorList", defaultMeteors);
meteorsProp.setComment("These are meteors. Huzzah!");
if (resyncMeteorOnVersionChange && configVersionChanged)
{
meteorsProp.set(defaultMeteors);
ModMeteors.meteors = defaultMeteors;
} else
{
ModMeteors.meteors = meteorsProp.getStringList();
}
config.save();
}