Fix a few things, start on recipes

This commit is contained in:
Aidan Brady 2014-01-13 18:37:54 -05:00
parent 398dffb7ce
commit 0aafa16106
3 changed files with 48 additions and 14 deletions

View file

@ -22,7 +22,7 @@ public final class RecipeHelper
public static void addEnrichmentChamberRecipe(ItemStack input, ItemStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler");
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addEnrichmentChamberRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);
} catch(Exception e) {
@ -38,7 +38,7 @@ public final class RecipeHelper
public static void addOsmiumCompressorRecipe(ItemStack input, ItemStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler");
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addOsmiumCompressorRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);
} catch(Exception e) {
@ -54,7 +54,7 @@ public final class RecipeHelper
public static void addCombinerRecipe(ItemStack input, ItemStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler");
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addCombinerRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);
} catch(Exception e) {
@ -70,7 +70,7 @@ public final class RecipeHelper
public static void addCrusherRecipe(ItemStack input, ItemStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler");
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addCrusherRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);
} catch(Exception e) {
@ -86,7 +86,7 @@ public final class RecipeHelper
public static void addPurificationChamberRecipe(ItemStack input, ItemStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler");
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addPurificationChamberRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);
} catch(Exception e) {
@ -102,7 +102,7 @@ public final class RecipeHelper
public static void addChemicalOxidizerRecipe(ItemStack input, GasStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler");
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addChemicalOxidizerRecipe", ItemStack.class, GasStack.class);
m.invoke(null, input, output);
} catch(Exception e) {
@ -118,7 +118,7 @@ public final class RecipeHelper
public static void addChemicalInfuserRecipe(ChemicalPair input, GasStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler");
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addChemicalInfuserRecipe", ChemicalPair.class, GasStack.class);
m.invoke(null, input, output);
} catch(Exception e) {
@ -126,6 +126,22 @@ public final class RecipeHelper
}
}
/**
* Add a Precision Sawmill recipe.
* @param input - input ItemStack
* @param output - output ChanceOutput
*/
public static void addPrecisionSawmillRecipe(ItemStack input, ChanceOutput output)
{
try {
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addPrecisionSawmillRecipe", ItemStack.class, ChanceOutput.class);
m.invoke(null, input, output);
} catch(Exception e) {
System.err.println("[Mekanism] Error while adding recipe: " + e.getMessage());
}
}
/**
* Add a Chemical Injection Chamber recipe.
* @param input - input ItemStack
@ -134,7 +150,7 @@ public final class RecipeHelper
public static void addChemicalInjectionChamberRecipe(ItemStack input, ItemStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler");
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addChemicalInjectionChamberRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, output);
} catch(Exception e) {
@ -150,7 +166,7 @@ public final class RecipeHelper
public static void addElectrolyticSeparatorRecipe(FluidStack input, ChemicalPair output)
{
try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler");
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addElectrolyticSeparatorRecipe", FluidStack.class, ChemicalPair.class);
m.invoke(null, input, output);
} catch(Exception e) {
@ -166,7 +182,7 @@ public final class RecipeHelper
public static void addMetallurgicInfuserRecipe(InfusionInput input, ItemStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler");
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addMetallurgicInfuserRecipe", InfusionInput.class, ItemStack.class);
m.invoke(null, input, output);
} catch(Exception e) {

View file

@ -46,7 +46,7 @@ public abstract class ChanceMachineRecipeHandler extends TemplateRecipeHandler
if(recipe.output.hasSecondary())
{
drawString(Math.round(recipe.output.secondaryChance*100) + "%", 116, 52, 0x404040);
drawString(Math.round(recipe.output.secondaryChance*100) + "%", 116, 52, 0x404040, false);
}
}
@ -120,13 +120,23 @@ public abstract class ChanceMachineRecipeHandler extends TemplateRecipeHandler
@Override
public PositionedStack getResult()
{
return new PositionedStack(output.primaryOutput, 100, 30);
if(output.hasPrimary())
{
return new PositionedStack(output.primaryOutput, 100, 30);
}
return null;
}
@Override
public PositionedStack getOtherStack()
{
return new PositionedStack(output.secondaryOutput, 116, 30);
if(output.hasSecondary())
{
return new PositionedStack(output.secondaryOutput, 116, 30);
}
return null;
}
public CachedIORecipe(ItemStack itemstack, ChanceOutput chance)

View file

@ -10,6 +10,7 @@ import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import mekanism.api.ChanceOutput;
import mekanism.api.ChemicalPair;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
@ -642,7 +643,14 @@ public class Mekanism
//Chemical Injection Chamber Recipes
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Block.obsidian), new ItemStack(Shard, 3, 6));
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Item.gunpowder), new ItemStack(Dust, 1, 10));
//Precision Sawmill Recipes
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Block.ladder, 3), new ChanceOutput(new ItemStack(Item.stick, 7)));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Block.chest), new ChanceOutput(new ItemStack(Block.planks, 8)));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Block.trapdoor), new ChanceOutput(new ItemStack(Block.planks, 3)));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Item.boat), new ChanceOutput(new ItemStack(Block.planks, 5)));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Item.bed), new ChanceOutput(new ItemStack(Block.planks, 3), new ItemStack(Block.cloth, 3), 1));
//Metallurgic Infuser Recipes
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("CARBON"), 10, new ItemStack(Item.ingotIron)), new ItemStack(EnrichedIron));
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("CARBON"), 10, new ItemStack(EnrichedIron)), new ItemStack(Dust, 1, 5));