Added some more recipes (like rudimentary ore doubling) to the alchemy table

This commit is contained in:
WayofTime 2016-05-04 19:25:42 -04:00
parent 86efa8b1a3
commit 37cb2a1360
15 changed files with 293 additions and 32 deletions

View file

@ -166,6 +166,7 @@ public class Constants
BOUND_SWORD("ItemBoundSword"),
BUCKET_ESSENCE("ItemBucketEssence"),
COMPONENT("ItemComponent"),
CUTTING_FLUID("ItemCuttingFluid"),
DEMON_CRYSTAL("ItemDemonCrystal"),
DAGGER_OF_SACRIFICE("ItemDaggerOfSacrifice"),
INSCRIPTION_TOOL("ItemInscriptionTool"),

View file

@ -0,0 +1,12 @@
package WayofTime.bloodmagic.api.iface;
import net.minecraft.item.ItemStack;
/**
* An interface for items that have custom drainage behaviour when used in
* certain alchemy recipes.
*/
public interface ICustomAlchemyConsumable
{
ItemStack drainUseOnAlchemyCraft(ItemStack stack);
}

View file

@ -0,0 +1,53 @@
package WayofTime.bloodmagic.api.recipe;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.api.iface.ICustomAlchemyConsumable;
public class AlchemyTableCustomRecipe extends AlchemyTableRecipe
{
public AlchemyTableCustomRecipe(Block result, int lpDrained, int ticksRequired, int tierRequired, Object... recipe)
{
this(new ItemStack(result), lpDrained, ticksRequired, tierRequired, recipe);
}
public AlchemyTableCustomRecipe(Item result, int lpDrained, int ticksRequired, int tierRequired, Object... recipe)
{
this(new ItemStack(result), lpDrained, ticksRequired, tierRequired, recipe);
}
public AlchemyTableCustomRecipe(ItemStack result, int lpDrained, int ticksRequired, int tierRequired, Object... recipe)
{
super(result, lpDrained, ticksRequired, tierRequired, recipe);
}
@Override
protected ItemStack getContainerItem(ItemStack stack)
{
if (stack == null)
{
return null;
}
ItemStack copyStack = stack.copy();
if (copyStack.getItem() instanceof ICustomAlchemyConsumable)
{
return ((ICustomAlchemyConsumable) copyStack.getItem()).drainUseOnAlchemyCraft(copyStack);
}
if (copyStack.getItem().hasContainerItem(stack))
{
return copyStack.getItem().getContainerItem(copyStack);
}
copyStack.stackSize--;
if (copyStack.stackSize <= 0)
{
return null;
}
return copyStack;
}
}