mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-19 19:49:50 +00:00
Metallurgy was easier than expected.
This commit is contained in:
1 parent
26463711de
commit
f463416c0c
4 files changed
+14
-3
No files matched your search
@@ -0,0 +1,12 @@
|
||||
package rebelkeithy.mods.metallurgy.api;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface IMetalSet
|
||||
{
|
||||
public IOreInfo getOreInfo(int metadata);
|
||||
|
||||
public IOreInfo getOreInfo(String name);
|
||||
|
||||
public Map<String, IOreInfo> getOreList();
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package rebelkeithy.mods.metallurgy.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IOreInfo
|
||||
{
|
||||
// Returns an array of OreDictionary keys of the dusts the make this if it's
|
||||
// an alloy
|
||||
// if it's not an alloy, this returns null
|
||||
public String[] getAlloyRecipe();
|
||||
|
||||
public ItemStack getBlock();
|
||||
|
||||
public ItemStack getBrick();
|
||||
|
||||
// If this ore drops something other than itself, this returns the ItemStack
|
||||
// of the drop, otherwise returns null
|
||||
public ItemStack getDrop();
|
||||
|
||||
public int getDropAmountMax();
|
||||
|
||||
public int getDropAmountMin();
|
||||
|
||||
// Returns the itemstack of dust this ore crushes into, if no dust exists,
|
||||
// returns null
|
||||
public ItemStack getDust();
|
||||
|
||||
// Returns the itemstack of ingot for this ore, if no ingot exists, returns
|
||||
// null
|
||||
public ItemStack getIngot();
|
||||
|
||||
public String getName();
|
||||
|
||||
public ItemStack getOre();
|
||||
|
||||
public OreType getType();
|
||||
|
||||
public boolean isEnabled();
|
||||
|
||||
public int getBlockHarvestLevel();
|
||||
|
||||
public int getToolHarvestLevel();
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package rebelkeithy.mods.metallurgy.api;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class MetallurgyAPI
|
||||
{
|
||||
|
||||
// Values for name: "base", "precious", "nether", "fantasy", "ender",
|
||||
// "utility", "vanilla"
|
||||
public static IMetalSet getMetalSet(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
String className = "rebelkeithy.mods.metallurgy.metals.MetallurgyMetals";
|
||||
|
||||
if (name.equals("vanilla"))
|
||||
{
|
||||
className = "rebelkeithy.mods.metallurgy.vanilla.MetallurgyVanilla";
|
||||
}
|
||||
|
||||
final Class<?> metallurgyMetals = Class.forName(className);
|
||||
final Field set = metallurgyMetals.getField(name + "Set");
|
||||
return (IMetalSet) set.get(null);
|
||||
} catch (final NoSuchFieldException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (final SecurityException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (final ClassNotFoundException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (final IllegalArgumentException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (final IllegalAccessException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String[] getMetalSetNames()
|
||||
{
|
||||
// TODO maybe put something to get runtime list here
|
||||
final String[] names =
|
||||
{ "base", "precious", "nether", "fantasy", "ender", "utility", "vanilla" };
|
||||
return names;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package rebelkeithy.mods.metallurgy.api;
|
||||
|
||||
public enum OreType
|
||||
{
|
||||
|
||||
ORE(true), CATALYST(true), ALLOY(false), RESPAWN(true), DROP(true);
|
||||
|
||||
private boolean generates;
|
||||
|
||||
OreType(boolean generates)
|
||||
{
|
||||
this.generates = generates;
|
||||
}
|
||||
|
||||
public boolean generates()
|
||||
{
|
||||
return generates;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user