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

@ -4,6 +4,7 @@ Version 2.0.0-36
- Added JEI compat for the Alchemy Table
- Changed the Item Routing system so that it used capabilities instead
- Updated the Alchemy Table recipe system so that it can provide better custom recipes.
- Added some more recipes (like rudimentary ore doubling) to the alchemy table.
------------------------------------------------------
Version 2.0.0-35

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;
}
}

View file

@ -1,20 +1,22 @@
package WayofTime.bloodmagic.item;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.registry.ModItems;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import java.util.ArrayList;
import java.util.List;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.registry.ModItems;
public class ItemComponent extends Item implements IVariantProvider
{
@ -40,6 +42,9 @@ public class ItemComponent extends Item implements IVariantProvider
public static final String REAGENT_SEVERANCE = "reagentSeverance";
public static final String REAGENT_TELEPOSITION = "reagentTeleposition";
public static final String REAGENT_TRANSPOSITION = "reagentTransposition";
public static final String SAND_IRON = "ironSand";
public static final String SAND_GOLD = "goldSand";
public static final String SAND_COAL = "coalSand";
public ItemComponent()
{
@ -73,6 +78,9 @@ public class ItemComponent extends Item implements IVariantProvider
names.add(16, REAGENT_SEVERANCE);
names.add(17, REAGENT_TELEPOSITION);
names.add(18, REAGENT_TRANSPOSITION);
names.add(19, SAND_IRON);
names.add(20, SAND_GOLD);
names.add(21, SAND_COAL);
}
@Override
@ -102,4 +110,12 @@ public class ItemComponent extends Item implements IVariantProvider
ret.add(new ImmutablePair<Integer, String>(names.indexOf(name), "type=" + name));
return ret;
}
public static ItemStack getStack(String key, int stackSize)
{
ItemStack stack = getStack(key);
stack.stackSize = stackSize;
return stack;
}
}

View file

@ -0,0 +1,136 @@
package WayofTime.bloodmagic.item.alchemy;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.ICustomAlchemyConsumable;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.registry.ModItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
public class ItemCuttingFluid extends Item implements IVariantProvider, ICustomAlchemyConsumable
{
@Getter
private static ArrayList<String> names = new ArrayList<String>();
public static final String BASIC = "basicCuttingFluid";
public ItemCuttingFluid()
{
super();
setUnlocalizedName(Constants.Mod.MODID + ".cuttingFluid.");
setHasSubtypes(true);
setCreativeTab(BloodMagic.tabBloodMagic);
setMaxStackSize(1);
buildItemList();
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
{
int max = getMaxUsesForFluid(stack);
tooltip.add(TextHelper.localize("tooltip.BloodMagic.cuttingFluidRatio", max - getDamageOfFluid(stack), max));
}
private void buildItemList()
{
names.add(0, BASIC);
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
return super.getUnlocalizedName(stack) + names.get(stack.getItemDamage());
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
{
for (int i = 0; i < names.size(); i++)
list.add(new ItemStack(id, 1, i));
}
public static ItemStack getStack(String name)
{
return new ItemStack(ModItems.cuttingFluid, 1, names.indexOf(name));
}
@Override
public List<Pair<Integer, String>> getVariants()
{
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
for (String name : names)
ret.add(new ImmutablePair<Integer, String>(names.indexOf(name), "type=" + name));
return ret;
}
public int getDamageOfFluid(ItemStack stack)
{
NBTHelper.checkNBT(stack);
NBTTagCompound tag = stack.getTagCompound();
return tag.getInteger("used");
}
public void applyDamageToFluid(ItemStack stack)
{
int damage = Math.min(getDamageOfFluid(stack) + 1, getMaxUsesForFluid(stack));
NBTTagCompound tag = stack.getTagCompound();
tag.setInteger("used", damage);
}
public int getMaxUsesForFluid(ItemStack stack)
{
switch (stack.getMetadata())
{
case 0:
return 16;
default:
return 1;
}
}
@Override
public double getDurabilityForDisplay(ItemStack stack)
{
return (double) (getDamageOfFluid(stack)) / (double) (getMaxUsesForFluid(stack));
}
@Override
public boolean showDurabilityBar(ItemStack stack)
{
return getDamageOfFluid(stack) > 0;
}
@Override
public ItemStack drainUseOnAlchemyCraft(ItemStack stack)
{
applyDamageToFluid(stack);
if (getDamageOfFluid(stack) >= getMaxUsesForFluid(stack))
{
return null;
}
return stack;
}
}

View file

@ -33,6 +33,7 @@ import WayofTime.bloodmagic.item.ItemSlate;
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
import WayofTime.bloodmagic.item.ItemUpgradeTome;
import WayofTime.bloodmagic.item.ItemUpgradeTrainer;
import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid;
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
@ -150,6 +151,8 @@ public class ModItems
public static Item nodeRouter;
public static Item baseItemFilter;
public static Item cuttingFluid;
public static Item.ToolMaterial boundToolMaterial = EnumHelper.addToolMaterial("BoundToolMaterial", 4, 1, 10, 8, 50);
public static Item.ToolMaterial soulToolMaterial = EnumHelper.addToolMaterial("SoulToolMaterial", 4, 520, 7, 8, 50);
@ -244,6 +247,8 @@ public class ModItems
nodeRouter = registerItem(new ItemNodeRouter(), Constants.BloodMagicItem.NODE_ROUTER.getRegName());
baseItemFilter = registerItem(new ItemRouterFilter(), Constants.BloodMagicItem.ROUTER_FILTER.getRegName());
cuttingFluid = registerItem(new ItemCuttingFluid(), Constants.BloodMagicItem.CUTTING_FLUID.getRegName());
}
public static void initRenders()

View file

@ -1,10 +1,21 @@
package WayofTime.bloodmagic.registry;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBinding;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
import WayofTime.bloodmagic.api.compress.CompressionRegistry;
import WayofTime.bloodmagic.api.recipe.AlchemyTableCustomRecipe;
import WayofTime.bloodmagic.api.recipe.ShapedBloodOrbRecipe;
import WayofTime.bloodmagic.api.recipe.ShapelessBloodOrbRecipe;
import WayofTime.bloodmagic.api.registry.AlchemyArrayRecipeRegistry;
@ -20,19 +31,11 @@ import WayofTime.bloodmagic.compress.BaseCompressionHandler;
import WayofTime.bloodmagic.compress.StorageBlockCraftingManager;
import WayofTime.bloodmagic.item.ItemComponent;
import WayofTime.bloodmagic.item.ItemDemonCrystal;
import WayofTime.bloodmagic.item.alchemy.ItemCuttingFluid;
import WayofTime.bloodmagic.item.soul.ItemSoulGem;
import com.google.common.base.Stopwatch;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class ModRecipes
{
public static void init()
@ -40,6 +43,8 @@ public class ModRecipes
RecipeSorter.register(Constants.Mod.DOMAIN + "shapedorb", ShapedBloodOrbRecipe.class, RecipeSorter.Category.SHAPED, "before:minecraft:shapeless");
RecipeSorter.register(Constants.Mod.DOMAIN + "shapelessorb", ShapelessBloodOrbRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
initOreDict();
addFurnaceRecipes();
addCraftingRecipes();
addAltarRecipes();
addAlchemyArrayRecipes();
@ -47,6 +52,19 @@ public class ModRecipes
addAlchemyTableRecipes();
}
public static void initOreDict()
{
OreDictionary.registerOre("dustIron", ItemComponent.getStack(ItemComponent.SAND_IRON));
OreDictionary.registerOre("dustGold", ItemComponent.getStack(ItemComponent.SAND_GOLD));
OreDictionary.registerOre("dustCoal", ItemComponent.getStack(ItemComponent.SAND_COAL));
}
public static void addFurnaceRecipes()
{
FurnaceRecipes.instance().addSmeltingRecipe(ItemComponent.getStack(ItemComponent.SAND_IRON), new ItemStack(Items.IRON_INGOT), (float) 0.15);
FurnaceRecipes.instance().addSmeltingRecipe(ItemComponent.getStack(ItemComponent.SAND_GOLD), new ItemStack(Items.GOLD_INGOT), (float) 0.15);
}
public static void addCraftingRecipes()
{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.soulForge), "i i", "sgs", "sos", 'i', "ingotIron", 's', "stone", 'g', "ingotGold", 'o', "blockIron"));
@ -100,7 +118,7 @@ public class ModRecipes
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.experienceTome), "ses", "lbl", "gog", 'o', OrbRegistry.getOrbStack(ModItems.orbMagician), 'e', Blocks.LAPIS_BLOCK, 'l', new ItemStack(ModItems.slate, 1, 2), 'b', Items.ENCHANTED_BOOK, 's', Items.STRING, 'g', "ingotGold"));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModItems.ritualReader), "gog", "isi", " s ", 's', new ItemStack(ModItems.slate, 1, 3), 'g', "blockGlass", 'i', "ingotGold", 'o', OrbRegistry.getOrbStack(ModItems.orbMaster)));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.alchemyTable), "sss", "wbw", "gog", 's', "stone", 'w', Blocks.WOOL, 'b', Items.BLAZE_ROD, 'g', "ingotGold", 'o', OrbRegistry.getOrbStack(ModItems.orbWeak)));
GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.alchemyTable), "sss", "wbw", "gog", 's', "stone", 'w', "plankWood", 'b', Items.BLAZE_ROD, 'g', "ingotGold", 'o', OrbRegistry.getOrbStack(ModItems.orbWeak)));
for (int i = 1; i < BlockBloodRune.names.length; i++)
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.bloodRune), new ItemStack(ModBlocks.bloodRune, 1, i)));
@ -271,5 +289,10 @@ public class ModRecipes
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Items.CLAY_BALL, 4), 50, 100, 2, Items.WATER_BUCKET, "sand");
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Blocks.CLAY, 5), 200, 200, 1, Items.WATER_BUCKET, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY, Blocks.HARDENED_CLAY);
AlchemyTableRecipeRegistry.registerRecipe(new ItemStack(Blocks.OBSIDIAN), 50, 50, 1, Items.WATER_BUCKET, Items.LAVA_BUCKET);
AlchemyTableRecipeRegistry.registerRecipe(ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC), 1000, 400, 1, "dustCoal", Items.GUNPOWDER, Items.REDSTONE, Items.SUGAR, Items.WHEAT, new ItemStack(Items.POTIONITEM));
AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableCustomRecipe(ItemComponent.getStack(ItemComponent.SAND_IRON, 2), 100, 200, 1, "oreIron", ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC)));
AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTableCustomRecipe(ItemComponent.getStack(ItemComponent.SAND_GOLD, 2), 100, 200, 1, "oreGold", ItemCuttingFluid.getStack(ItemCuttingFluid.BASIC)));
}
}

View file

@ -101,29 +101,19 @@
"layer0": "bloodmagic:items/ReagentTransposition"
}
},
"crystaldefault": {
"ironsand": {
"textures": {
"layer0": "bloodmagic:items/DefaultCrystal"
"layer0": "bloodmagic:items/IronSand"
}
},
"crystalcorrosive": {
"goldsand": {
"textures": {
"layer0": "bloodmagic:items/CorrosiveCrystal"
"layer0": "bloodmagic:items/GoldSand"
}
},
"crystalvengeful": {
"coalsand": {
"textures": {
"layer0": "bloodmagic:items/VengefulCrystal"
}
},
"crystaldestructive": {
"textures": {
"layer0": "bloodmagic:items/DestructiveCrystal"
}
},
"crystalsteadfast": {
"textures": {
"layer0": "bloodmagic:items/SteadfastCrystal"
"layer0": "bloodmagic:items/CoalSand"
}
}
}

View file

@ -0,0 +1,16 @@
{
"forge_marker": 1,
"defaults": {
"model": "builtin/generated",
"transform": "forge:default-item"
},
"variants": {
"type": {
"basiccuttingfluid": {
"textures": {
"layer0": "bloodmagic:items/BasicCuttingFluid"
}
}
}
}
}

View file

@ -87,6 +87,12 @@ item.BloodMagic.baseComponent.reagentSeverance.name=Severance Reagent
item.BloodMagic.baseComponent.reagentTeleposition.name=Teleposition Reagent
item.BloodMagic.baseComponent.reagentTransposition.name=Transposition Reagent
item.BloodMagic.baseComponent.ironSand.name=Iron Sand
item.BloodMagic.baseComponent.goldSand.name=Gold Sand
item.BloodMagic.baseComponent.coalSand.name=Coal Sand
item.BloodMagic.cuttingFluid.basicCuttingFluid.name=Basic Cutting Fluid
item.BloodMagic.demonCrystal.crystalDefault.name=Demon Will Crystal
item.BloodMagic.demonCrystal.crystalCorrosive.name=Corrosive Will Crystal
item.BloodMagic.demonCrystal.crystalDestructive.name=Destructive Will Crystal
@ -374,6 +380,8 @@ tooltip.BloodMagic.experienceTome.expLevel=Level: %d
tooltip.BloodMagic.decoration.safe=Safe for decoration
tooltip.BloodMagic.decoration.notSafe=Dangerous for decoration
tooltip.BloodMagic.cuttingFluidRatio=%d/%d uses remaining
# Ritual
ritual.BloodMagic.blockRange.tooBig=The block range given is too big! Needs to be at most %s blocks.
ritual.BloodMagic.blockRange.tooFar=The block range given is too far! Needs to be within a vertical range of %s blocks and a horizontal range of %s blocks.

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B