Begin CTM refactor. Submaps working, lighting not so much

This commit is contained in:
tterrag1098 committed 2015-02-18 15:27:57 -05:00
1 parent ba3f7eb57a
commit 3f2e39ceb8
12 files changed
+638 -427

No files matched your search

@@ -31,16 +31,20 @@ public class CarvingUtils {
}
private static Field _chisel;
private static boolean errored = false;
private static boolean registryErrored = false;
private static final String CARVING_CLASS = "com.cricketcraft.chisel.carving.Carving";
private static Class<ICarvableHelper> _carvableHelper;
private static boolean helperErrored = false;
private static final String CARVABLE_HELPER_CLASS = "com.cricketcraft.carving.CarvableHelper";
/**
* @return The instance of the chisel carving registry from the chisel mod.
* <p>
* If chisel is not installed or some other error occurs this will return null.
*/
public static ICarvingRegistry getChiselRegistry() {
if (errored) {
if (registryErrored) {
return null;
}
@@ -51,8 +55,31 @@ public class CarvingUtils {
return (ICarvingRegistry) _chisel.get(null);
} catch (Exception e) {
e.printStackTrace();
errored = true;
registryErrored = true;
return getChiselRegistry();
}
}
/**
* @return An instance of an {@link ICarvableHelper}.
* <p>
* If chisel is not installed or some other error occurs this will return null.
*/
@SuppressWarnings("unchecked")
public static ICarvableHelper getCarvableHelperInstance() {
if (helperErrored) {
return null;
}
try {
if (_carvableHelper == null) {
_carvableHelper = (Class<ICarvableHelper>) Class.forName(CARVABLE_HELPER_CLASS);
}
return _carvableHelper.newInstance();
} catch (Exception e) {
e.printStackTrace();
helperErrored = true;
return getCarvableHelperInstance();
}
}
}