Updated IC2 API (again), added obsidian 200% ore-to-dust processing

This commit is contained in:
Aidan Brady 2013-08-25 12:02:25 -04:00
parent 9a6f4d6a0e
commit 55fee96644
10 changed files with 54 additions and 116 deletions

View file

@ -1,45 +0,0 @@
package ic2.api.keyboard;
import net.minecraft.entity.player.EntityPlayer;
public class Keys {
public static boolean isModeKeyPressed(EntityPlayer aPlayer) {
return getKeyPressed(aPlayer, "isModeSwitchKeyDown");
}
public static boolean isAltKeyPressed(EntityPlayer aPlayer) {
return getKeyPressed(aPlayer, "isAltKeyDown");
}
public static boolean isHudModeKeyPressed(EntityPlayer aPlayer) {
return getKeyPressed(aPlayer, "isHudModeKeyDown");
}
public static boolean isBoostKeyPressed(EntityPlayer aPlayer) {
return getKeyPressed(aPlayer, "isBoostKeyDown");
}
public static boolean isForwardKeyPressed(EntityPlayer aPlayer) {
return getKeyPressed(aPlayer, "isForwardKeyDown");
}
public static boolean isJumpKeyPressed(EntityPlayer aPlayer) {
return getKeyPressed(aPlayer, "isJumpKeyDown");
}
public static boolean isSideInventoryKeyPressed(EntityPlayer aPlayer) {
return getKeyPressed(aPlayer, "isSideinventoryKeyDown");
}
public static boolean isSneakKeyPressed(EntityPlayer aPlayer) {
return getKeyPressed(aPlayer, "isSneakKeyDown");
}
public static boolean getKeyPressed(EntityPlayer aPlayer, String aKeyName) {
Object tObject = ic2.api.util.ReflectionHelper.callMethod(ic2.api.util.ReflectionHelper.getField(ic2.api.info.Info.ic2ModInstance, "keyboard", false, true), "isModeSwitchKeyDown", false, false, true, aPlayer);
if (tObject != null && tObject instanceof Boolean) {
return (Boolean)tObject;
}
return false;
}
}

View file

@ -0,0 +1,9 @@
package ic2.api.recipe;
import net.minecraft.item.ItemStack;
public interface IPatternStorage {
boolean transferPattern(ItemStack itemstack, short amountUU , int amountEU);
}

View file

@ -13,10 +13,11 @@ public class Recipes {
public static IMachineRecipeManager compressor; public static IMachineRecipeManager compressor;
public static IMachineRecipeManager centrifuge; public static IMachineRecipeManager centrifuge;
public static IMachineRecipeManager recycler; public static IMachineRecipeManager recycler;
public static IMachineRecipeManager metalformerextruding; public static IMachineRecipeManager metalformerExtruding;
public static IMachineRecipeManager metalformercutting; public static IMachineRecipeManager metalformerCutting;
public static IMachineRecipeManager metalformerrolling; public static IMachineRecipeManager metalformerRolling;
public static IMachineRecipeManager orewasching; public static IMachineRecipeManager orewasching;
public static IMachineRecipeManager Scanner;
/** /**
* Reference amplifier values: * Reference amplifier values:

View file

@ -0,0 +1,14 @@
package ic2.api.util;
import net.minecraft.entity.player.EntityPlayer;
public interface IKeyboard {
boolean isAltKeyDown(EntityPlayer player);
boolean isBoostKeyDown(EntityPlayer player);
boolean isForwardKeyDown(EntityPlayer player);
boolean isJumpKeyDown(EntityPlayer player);
boolean isModeSwitchKeyDown(EntityPlayer player);
boolean isSideinventoryKeyDown(EntityPlayer player);
boolean isHudModeKeyDown(EntityPlayer player);
boolean isSneakKeyDown(EntityPlayer player);
}

View file

@ -0,0 +1,6 @@
package ic2.api.util;
public class Keys {
public static IKeyboard instance;
}

View file

@ -1,55 +0,0 @@
package ic2.api.util;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class ReflectionHelper {
public static Object callMethod(Object aObject, String aMethod, boolean aPrivate, boolean aUseUpperCasedDataTypes, boolean aLogErrors, Object... aParameters) {
try {
Class<?>[] tParameterTypes = new Class<?>[aParameters.length];
for (byte i = 0; i < aParameters.length; i++) {
if (aParameters[i] instanceof Class) {
tParameterTypes[i] = (Class)aParameters[i];
aParameters[i] = null;
} else {
tParameterTypes[i] = aParameters[i].getClass();
}
if (!aUseUpperCasedDataTypes) {
if (tParameterTypes[i] == Boolean.class ) tParameterTypes[i] = boolean.class;
if (tParameterTypes[i] == Byte.class ) tParameterTypes[i] = byte.class;
if (tParameterTypes[i] == Short.class ) tParameterTypes[i] = short.class;
if (tParameterTypes[i] == Integer.class ) tParameterTypes[i] = int.class;
if (tParameterTypes[i] == Long.class ) tParameterTypes[i] = long.class;
if (tParameterTypes[i] == Float.class ) tParameterTypes[i] = float.class;
if (tParameterTypes[i] == Double.class ) tParameterTypes[i] = double.class;
}
}
Method tMethod = (aObject instanceof Class)?((Class)aObject).getMethod(aMethod, tParameterTypes):aObject.getClass().getMethod(aMethod, tParameterTypes);
if (aPrivate) tMethod.setAccessible(true);
return tMethod.invoke(aObject, aParameters);
} catch (Throwable e) {
if (aLogErrors) e.printStackTrace();
}
return null;
}
public static Object callConstructor(String aClass, int aConstructorIndex, Object aReplacementObject, boolean aLogErrors, Object... aParameters) {
try {
return Class.forName(aClass).getConstructors()[aConstructorIndex].newInstance(aParameters);
} catch (Throwable e) {
if (aLogErrors) e.printStackTrace();
}
return aReplacementObject;
}
public static Object getField(Object aObject, String aField, boolean aPrivate, boolean aLogErrors) {
try {
Field tField = (aObject instanceof Class)?((Class)aObject).getDeclaredField(aField):aObject.getClass().getDeclaredField(aField);
if (aPrivate) tField.setAccessible(true);
return tField.get(aObject);
} catch (Throwable e) {
if (aLogErrors) e.printStackTrace();
}
return null;
}
}

View file

@ -11,7 +11,8 @@ public class ItemClump extends ItemMekanism
{ {
public Icon[] icons = new Icon[256]; public Icon[] icons = new Icon[256];
public static String[] en_USNames = {"Iron", "Gold", "Osmium", public static String[] en_USNames = {"Iron", "Gold", "Osmium",
"Copper", "Tin", "Silver"}; "Copper", "Tin", "Silver",
"Obsidian"};
public ItemClump(int id) public ItemClump(int id)
{ {
@ -23,7 +24,7 @@ public class ItemClump extends ItemMekanism
@Override @Override
public void registerIcons(IconRegister register) public void registerIcons(IconRegister register)
{ {
for(int i = 0; i <= 5; i++) for(int i = 0; i <= 6; i++)
{ {
icons[i] = register.registerIcon("mekanism:" + en_USNames[i] + "Clump"); icons[i] = register.registerIcon("mekanism:" + en_USNames[i] + "Clump");
} }
@ -38,7 +39,7 @@ public class ItemClump extends ItemMekanism
@Override @Override
public void getSubItems(int id, CreativeTabs tabs, List itemList) public void getSubItems(int id, CreativeTabs tabs, List itemList)
{ {
for(int counter = 0; counter <= 5; ++counter) for(int counter = 0; counter <= 6; ++counter)
{ {
itemList.add(new ItemStack(this, 1, counter)); itemList.add(new ItemStack(this, 1, counter));
} }

View file

@ -446,6 +446,9 @@ public class Mekanism
RecipeHandler.addCrusherRecipe(new ItemStack(Block.stoneBrick, 1, 0), new ItemStack(Block.stoneBrick, 1, 2)); RecipeHandler.addCrusherRecipe(new ItemStack(Block.stoneBrick, 1, 0), new ItemStack(Block.stoneBrick, 1, 2));
RecipeHandler.addCrusherRecipe(new ItemStack(Block.stoneBrick, 1, 3), new ItemStack(Block.stoneBrick, 1, 0)); RecipeHandler.addCrusherRecipe(new ItemStack(Block.stoneBrick, 1, 3), new ItemStack(Block.stoneBrick, 1, 0));
//Purification Chamber Recipes
RecipeHandler.addPurificationChamberRecipe(new ItemStack(Block.obsidian), new ItemStack(Clump, 2, 6));
//Metallurgic Infuser Recipes //Metallurgic Infuser Recipes
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("CARBON"), 10, new ItemStack(EnrichedIron)), new ItemStack(Dust, 1, 5)); RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("CARBON"), 10, new ItemStack(EnrichedIron)), new ItemStack(Dust, 1, 5));
@ -559,6 +562,7 @@ public class Mekanism
LanguageRegistry.instance().addStringLocalization("item.copperClump.name", "Copper Clump"); LanguageRegistry.instance().addStringLocalization("item.copperClump.name", "Copper Clump");
LanguageRegistry.instance().addStringLocalization("item.tinClump.name", "Tin Clump"); LanguageRegistry.instance().addStringLocalization("item.tinClump.name", "Tin Clump");
LanguageRegistry.instance().addStringLocalization("item.silverClump.name", "Silver Clump"); LanguageRegistry.instance().addStringLocalization("item.silverClump.name", "Silver Clump");
LanguageRegistry.instance().addStringLocalization("item.obsidianClump.name", "Obsidian Clump");
//Localization for Dirty Dust //Localization for Dirty Dust
LanguageRegistry.instance().addStringLocalization("item.dirtyIronDust.name", "Dirty Iron Dust"); LanguageRegistry.instance().addStringLocalization("item.dirtyIronDust.name", "Dirty Iron Dust");
@ -711,7 +715,7 @@ public class Mekanism
OreDictionary.registerOre("dustDirtySilver", new ItemStack(DirtyDust, 1, 5)); OreDictionary.registerOre("dustDirtySilver", new ItemStack(DirtyDust, 1, 5));
OreDictionary.registerOre("dustDirtyObsidian", new ItemStack(DirtyDust, 1, 6)); OreDictionary.registerOre("dustDirtyObsidian", new ItemStack(DirtyDust, 1, 6));
//for RailCraft. rc + mek = rawr //for RailCraft/IC2.
OreDictionary.registerOre("dustObsidian", new ItemStack(DirtyDust, 1, 6)); OreDictionary.registerOre("dustObsidian", new ItemStack(DirtyDust, 1, 6));
OreDictionary.registerOre("clumpIron", new ItemStack(Clump, 1, 0)); OreDictionary.registerOre("clumpIron", new ItemStack(Clump, 1, 0));
@ -720,6 +724,7 @@ public class Mekanism
OreDictionary.registerOre("clumpCopper", new ItemStack(Clump, 1, 3)); OreDictionary.registerOre("clumpCopper", new ItemStack(Clump, 1, 3));
OreDictionary.registerOre("clumpTin", new ItemStack(Clump, 1, 4)); OreDictionary.registerOre("clumpTin", new ItemStack(Clump, 1, 4));
OreDictionary.registerOre("clumpSilver", new ItemStack(Clump, 1, 5)); OreDictionary.registerOre("clumpSilver", new ItemStack(Clump, 1, 5));
OreDictionary.registerOre("clumpObsidian", new ItemStack(Clump, 1, 6));
OreDictionary.registerOre("oreOsmium", new ItemStack(OreBlock, 1, 0)); OreDictionary.registerOre("oreOsmium", new ItemStack(OreBlock, 1, 0));
@ -737,6 +742,7 @@ public class Mekanism
CraftingManagers.pulverizerManager.addRecipe(80, new ItemStack(Clump, 1, 3), new ItemStack(DirtyDust, 1, 3), false); CraftingManagers.pulverizerManager.addRecipe(80, new ItemStack(Clump, 1, 3), new ItemStack(DirtyDust, 1, 3), false);
CraftingManagers.pulverizerManager.addRecipe(80, new ItemStack(Clump, 1, 4), new ItemStack(DirtyDust, 1, 4), false); CraftingManagers.pulverizerManager.addRecipe(80, new ItemStack(Clump, 1, 4), new ItemStack(DirtyDust, 1, 4), false);
CraftingManagers.pulverizerManager.addRecipe(80, new ItemStack(Clump, 1, 5), new ItemStack(DirtyDust, 1, 5), false); CraftingManagers.pulverizerManager.addRecipe(80, new ItemStack(Clump, 1, 5), new ItemStack(DirtyDust, 1, 5), false);
System.out.println("[Mekanism] Hooked into Thermal Expansion successfully."); System.out.println("[Mekanism] Hooked into Thermal Expansion successfully.");
} catch(Exception e) {} } catch(Exception e) {}
@ -748,20 +754,16 @@ public class Mekanism
OreDictionary.registerOre("itemCompressedCarbon", new ItemStack(CompressedCarbon)); OreDictionary.registerOre("itemCompressedCarbon", new ItemStack(CompressedCarbon));
OreDictionary.registerOre("itemEnrichedAlloy", new ItemStack(EnrichedAlloy)); OreDictionary.registerOre("itemEnrichedAlloy", new ItemStack(EnrichedAlloy));
if(hooks.IC2Loaded)
{
if(!hooks.RailcraftLoaded)
{
Recipes.macerator.addRecipe(new ItemStack(Block.obsidian), null, new ItemStack(DirtyDust, 1, 6));
}
}
for(ItemStack ore : OreDictionary.getOres("dustRefinedObsidian")) for(ItemStack ore : OreDictionary.getOres("dustRefinedObsidian"))
{ {
RecipeHandler.addOsmiumCompressorRecipe(MekanismUtils.size(ore, 1), new ItemStack(Ingot, 1, 0));
RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(DirtyDust, 1, 6)); RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(DirtyDust, 1, 6));
} }
for(ItemStack ore : OreDictionary.getOres("dustObsidian"))
{
RecipeHandler.addOsmiumCompressorRecipe(MekanismUtils.size(ore, 2), new ItemStack(Ingot, 1, 0));
}
for(ItemStack ore : OreDictionary.getOres("clumpIron")) for(ItemStack ore : OreDictionary.getOres("clumpIron"))
{ {
RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(DirtyDust, 1, 0)); RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(DirtyDust, 1, 0));
@ -792,6 +794,11 @@ public class Mekanism
RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(DirtyDust, 1, 5)); RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(DirtyDust, 1, 5));
} }
for(ItemStack ore : OreDictionary.getOres("clumpObsidian"))
{
RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(DirtyDust, 1, 6));
}
for(ItemStack ore : OreDictionary.getOres("dustDirtyIron")) for(ItemStack ore : OreDictionary.getOres("dustDirtyIron"))
{ {
RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Dust, 1, 0)); RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(Dust, 1, 0));

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB