mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-21 04:22:26 +00:00
Move the directory structure around to a more conventional one and start out on the 1.7 update.
3797 errors. We have a long way to go.
This commit is contained in:
1 parent
3a0de87a09
commit
ab47724473
1245 files changed
+1764
-5953
No files matched your search
@@ -0,0 +1,42 @@
|
||||
package mekanism.api;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
||||
/**
|
||||
* Class used to indirectly reference the Mekanism creative tab.
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public final class TabProxy
|
||||
{
|
||||
/** The 'Mekanism' class where the tab instance is stored. */
|
||||
public static Class Mekanism;
|
||||
|
||||
/**
|
||||
* Attempts to get the Mekanism creative tab instance from the 'Mekanism' class. Will return
|
||||
* the tab if the mod is loaded, but otherwise will return the defined 'preferred' creative tab. This way
|
||||
* you don't need to worry about NPEs!
|
||||
* @return Mekanism creative tab if can, otherwise preferred tab
|
||||
*/
|
||||
public static CreativeTabs tabMekanism(CreativeTabs preferred)
|
||||
{
|
||||
try {
|
||||
if(Mekanism == null)
|
||||
{
|
||||
Mekanism = Class.forName("mekanism.common.Mekanism");
|
||||
}
|
||||
|
||||
Object ret = Mekanism.getField("tabMekanism").get(null);
|
||||
|
||||
if(ret instanceof CreativeTabs)
|
||||
{
|
||||
return (CreativeTabs)ret;
|
||||
}
|
||||
|
||||
return preferred;
|
||||
} catch(Exception e) {
|
||||
System.err.println("[Mekanism] Error retrieving Mekanism creative tab.");
|
||||
return preferred;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user