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

@ -0,0 +1,89 @@
package WayofTime.bloodmagic.registry;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.meteor.MeteorComponent;
import WayofTime.bloodmagic.meteor.MeteorHolder;
import WayofTime.bloodmagic.meteor.MeteorRegistry;
import WayofTime.bloodmagic.util.Utils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class ModMeteors
{
public static String[] meteors = new String[] {};
public static void init()
{
Gson gson = new GsonBuilder().create();
List<String> properStrings = new ArrayList<String>();
String currentString = "";
int leftParenths = 0;
int rightParenths = 0;
for (String str : meteors)
{
currentString += str;
for (char c : str.toCharArray())
{
if (c == '{')
{
leftParenths++;
} else if (c == '}')
{
rightParenths++;
}
}
if (leftParenths == rightParenths)
{
properStrings.add(currentString);
currentString = "";
leftParenths = 0;
rightParenths = 0;
}
}
for (String properString : properStrings)
{
MeteorHolder holder = gson.fromJson(properString, MeteorHolder.class);
if (holder != null)
{
MeteorRegistry.registerMeteor(holder.getKeyStack(), holder);
}
}
}
public static String[] getDefaultMeteors()
{
Gson gson = new GsonBuilder().setPrettyPrinting().create();
List<MeteorHolder> holders = new ArrayList<MeteorHolder>();
List<MeteorComponent> ironMeteorList = new ArrayList<MeteorComponent>();
ironMeteorList.add(new MeteorComponent(400, "oreIron"));
ironMeteorList.add(new MeteorComponent(200, "oreCopper"));
ironMeteorList.add(new MeteorComponent(140, "oreTin"));
ironMeteorList.add(new MeteorComponent(70, "oreSilver"));
ironMeteorList.add(new MeteorComponent(80, "oreLead"));
ironMeteorList.add(new MeteorComponent(30, "oreGold"));
ironMeteorList.add(new MeteorComponent(60, "oreLapis"));
ironMeteorList.add(new MeteorComponent(100, "oreRedstone"));
MeteorHolder ironMeteorHolder = new MeteorHolder(Utils.getResourceForItem(new ItemStack(Blocks.IRON_BLOCK)), 0, ironMeteorList, 15, 5, 1000);
holders.add(ironMeteorHolder);
String[] meteors = new String[holders.size()];
for (int i = 0; i < holders.size(); i++)
{
meteors[i] = gson.toJson(holders.get(i), MeteorHolder.class);
}
return meteors;
}
}

View file

@ -1,10 +1,6 @@
package WayofTime.bloodmagic.registry;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.registry.HarvestRegistry;
@ -13,8 +9,6 @@ import WayofTime.bloodmagic.api.registry.RitualRegistry;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid;
import WayofTime.bloodmagic.meteor.MeteorComponent;
import WayofTime.bloodmagic.meteor.MeteorRegistry;
import WayofTime.bloodmagic.ritual.RitualAltarBuilder;
import WayofTime.bloodmagic.ritual.RitualAnimalGrowth;
import WayofTime.bloodmagic.ritual.RitualArmourEvolve;
@ -155,18 +149,6 @@ public class ModRituals
RitualCrushing.registerCuttingFluid(ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC), 250, 0.5);
RitualCrushing.registerCuttingFluid(ItemCuttingFluid.getStack(ItemCuttingFluid.EXPLOSIVE), 25, 0.05);
List<MeteorComponent> ironMeteorList = new ArrayList<MeteorComponent>();
ironMeteorList.add(new MeteorComponent(400, "oreIron"));
ironMeteorList.add(new MeteorComponent(200, "oreCopper"));
ironMeteorList.add(new MeteorComponent(140, "oreTin"));
ironMeteorList.add(new MeteorComponent(70, "oreSilver"));
ironMeteorList.add(new MeteorComponent(80, "oreLead"));
ironMeteorList.add(new MeteorComponent(30, "oreGold"));
ironMeteorList.add(new MeteorComponent(60, "oreLapis"));
ironMeteorList.add(new MeteorComponent(100, "oreRedstone"));
MeteorRegistry.registerMeteor(new ItemStack(Blocks.IRON_BLOCK), ironMeteorList, 15, 5, 1000);
}
public static void initImperfectRituals()