added getXmlDocumentBuilder

This commit is contained in:
Francesco Macagno 2015-08-14 18:50:47 -07:00
parent 4bbdf209a1
commit 0660941200

View file

@ -4,6 +4,10 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Random;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
@ -234,6 +238,8 @@ public class WarpDriveConfig {
public static int CL_MAX_DISTANCE = 2;
public static int CL_RF_PER_CHUNKTICK = 320;
private static DocumentBuilder xmlDocumentBuilder;
public static ItemStack getIC2Item(String id) {
return new ItemStack((Item) Item.itemRegistry.getObject("IC2:" + id));
}
@ -860,4 +866,20 @@ public class WarpDriveConfig {
public static void loadWorldGen() {
}
public static DocumentBuilder getXmlDocumentBuilder() {
if (xmlDocumentBuilder == null) {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setIgnoringComments(false);
dbf.setValidating(true);
try {
xmlDocumentBuilder = dbf.newDocumentBuilder();
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
}
return xmlDocumentBuilder;
}
}