Add crafting for biome finder (note biome essence now used up in recipe)
This commit is contained in:
parent
cc15216f66
commit
adcf216772
|
@ -0,0 +1,94 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright 2014, the Biomes O' Plenty Team
|
||||||
|
*
|
||||||
|
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||||
|
*
|
||||||
|
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
package biomesoplenty.common.crafting;
|
||||||
|
|
||||||
|
import biomesoplenty.api.item.BOPItems;
|
||||||
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class BiomeEssenceRecipe implements IRecipe
|
||||||
|
{
|
||||||
|
private ItemStack recipeOutput;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches(InventoryCrafting inventoryCrafting, World world)
|
||||||
|
{
|
||||||
|
ItemStack biomeRadar = null;
|
||||||
|
ItemStack biomeEssence = null;
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; ++i)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 3; ++j)
|
||||||
|
{
|
||||||
|
ItemStack itemstack = inventoryCrafting.getStackInRowAndColumn(j, i);
|
||||||
|
|
||||||
|
if (itemstack != null)
|
||||||
|
{
|
||||||
|
if (itemstack.getItem() == BOPItems.biome_finder) biomeRadar = itemstack.copy();
|
||||||
|
else if (itemstack.getItem() == BOPItems.biome_essence) biomeEssence = itemstack.copy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (biomeRadar != null && biomeEssence != null)
|
||||||
|
{
|
||||||
|
if (!biomeEssence.hasTagCompound() || !biomeEssence.getTagCompound().hasKey("biomeID")) return false;
|
||||||
|
|
||||||
|
int biomeID = biomeEssence.getTagCompound().getInteger("biomeID");
|
||||||
|
|
||||||
|
if (!biomeRadar.hasTagCompound()) biomeRadar.setTagCompound(new NBTTagCompound());
|
||||||
|
|
||||||
|
biomeRadar.getTagCompound().setInteger("biomeIDToFind", biomeID);
|
||||||
|
biomeRadar.getTagCompound().setBoolean("found", false);
|
||||||
|
|
||||||
|
recipeOutput = biomeRadar;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRecipeSize()
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getCraftingResult(InventoryCrafting var1)
|
||||||
|
{
|
||||||
|
return recipeOutput.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipeOutput()
|
||||||
|
{
|
||||||
|
return recipeOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getRemainingItems(InventoryCrafting inv)
|
||||||
|
{
|
||||||
|
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
|
||||||
|
|
||||||
|
for (int i = 0; i < aitemstack.length; ++i)
|
||||||
|
{
|
||||||
|
ItemStack itemstack = inv.getStackInSlot(i);
|
||||||
|
aitemstack[i] = net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
return aitemstack;
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,7 @@ import biomesoplenty.common.block.BlockBOPPlant;
|
||||||
import biomesoplenty.common.block.BlockBones;
|
import biomesoplenty.common.block.BlockBones;
|
||||||
import biomesoplenty.common.block.BlockGem;
|
import biomesoplenty.common.block.BlockGem;
|
||||||
import biomesoplenty.common.block.BlockHive;
|
import biomesoplenty.common.block.BlockHive;
|
||||||
|
import biomesoplenty.common.crafting.BiomeEssenceRecipe;
|
||||||
import biomesoplenty.common.handler.FurnaceFuelHandler;
|
import biomesoplenty.common.handler.FurnaceFuelHandler;
|
||||||
import biomesoplenty.common.item.ItemDart;
|
import biomesoplenty.common.item.ItemDart;
|
||||||
import biomesoplenty.common.item.ItemJarFilled;
|
import biomesoplenty.common.item.ItemJarFilled;
|
||||||
|
@ -286,6 +287,12 @@ public class ModCrafting
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.dart, 1, ItemDart.DartType.POISONDART.ordinal()), new Object[] {new ItemStack(BOPItems.jar_filled, 1, ItemJarFilled.JarContents.POISON.ordinal()), new ItemStack(BOPItems.dart, 1, ItemDart.DartType.DART.ordinal())});
|
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.dart, 1, ItemDart.DartType.POISONDART.ordinal()), new Object[] {new ItemStack(BOPItems.jar_filled, 1, ItemJarFilled.JarContents.POISON.ordinal()), new ItemStack(BOPItems.dart, 1, ItemDart.DartType.DART.ordinal())});
|
||||||
|
|
||||||
|
|
||||||
|
/*** Biome Finder ***/
|
||||||
|
|
||||||
|
GameRegistry.addShapedRecipe(new ItemStack(BOPItems.biome_finder), new Object[] {" E ", "ERE", " E ", 'E', new ItemStack(Items.emerald), 'R', new ItemStack(Items.redstone)});
|
||||||
|
GameRegistry.addRecipe(new BiomeEssenceRecipe());
|
||||||
|
|
||||||
|
|
||||||
/*** Misc Others ***/
|
/*** Misc Others ***/
|
||||||
|
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(Items.string), new Object[] {"FFF", "FFF", "FFF", 'F', ((BlockBOPDoublePlant)BOPBlocks.double_plant).getVariantItem(BlockBOPDoublePlant.FoliageType.FLAX)});
|
GameRegistry.addShapedRecipe(new ItemStack(Items.string), new Object[] {"FFF", "FFF", "FFF", 'F', ((BlockBOPDoublePlant)BOPBlocks.double_plant).getVariantItem(BlockBOPDoublePlant.FoliageType.FLAX)});
|
||||||
|
@ -301,8 +308,6 @@ public class ModCrafting
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(Blocks.mossy_cobblestone, 1, 0), new Object[] {"MMM", "MCM", "MMM", 'M', BOPBlocks.moss, 'C', Blocks.cobblestone});
|
GameRegistry.addShapedRecipe(new ItemStack(Blocks.mossy_cobblestone, 1, 0), new Object[] {"MMM", "MCM", "MMM", 'M', BOPBlocks.moss, 'C', Blocks.cobblestone});
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(Blocks.stonebrick, 1, 1), new Object[] {"MMM", "MSM", "MMM", 'M', BOPBlocks.moss, 'S', Blocks.stonebrick});
|
GameRegistry.addShapedRecipe(new ItemStack(Blocks.stonebrick, 1, 1), new Object[] {"MMM", "MSM", "MMM", 'M', BOPBlocks.moss, 'S', Blocks.stonebrick});
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(BOPItems.enderporter), new Object[] {"IOI", "OAO", "IOI", 'I', Items.ender_eye, 'O', new ItemStack(BOPItems.ghastly_soul), 'A', new ItemStack(BOPItems.gem, 1, BlockGem.GemType.AMETHYST.ordinal())});
|
GameRegistry.addShapedRecipe(new ItemStack(BOPItems.enderporter), new Object[] {"IOI", "OAO", "IOI", 'I', Items.ender_eye, 'O', new ItemStack(BOPItems.ghastly_soul), 'A', new ItemStack(BOPItems.gem, 1, BlockGem.GemType.AMETHYST.ordinal())});
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(BOPItems.biome_finder), new Object[] {" E ", "ERE", " E ", 'E', new ItemStack(Items.emerald), 'R', new ItemStack(Items.redstone)});
|
|
||||||
// TODO: GameRegistry.addShapedRecipe(new BiomeEssenceRecipe());
|
|
||||||
// TODO: bamboo thatching (was planks:10 in 1.7 ) GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.bamboo_thatching), new Object[] {"##", "##", '#', BOPBlocks.bamboo});
|
// TODO: bamboo thatching (was planks:10 in 1.7 ) GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.bamboo_thatching), new Object[] {"##", "##", '#', BOPBlocks.bamboo});
|
||||||
// TODO: GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.bamboo, 8), new Object [] {" #", "# ", '#', new ItemStack(BOPBlocks.bamboo_thatching)});
|
// TODO: GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.bamboo, 8), new Object [] {" #", "# ", '#', new ItemStack(BOPBlocks.bamboo_thatching)});
|
||||||
// TODO: GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.bamboo, 8), new Object [] {"# ", " #", '#', new ItemStack(BOPBlocks.bamboo_thatching)});
|
// TODO: GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.bamboo, 8), new Object [] {"# ", " #", '#', new ItemStack(BOPBlocks.bamboo_thatching)});
|
||||||
|
|
|
@ -21,19 +21,6 @@ public class ItemBiomeEssence extends Item
|
||||||
{
|
{
|
||||||
public ItemBiomeEssence() {}
|
public ItemBiomeEssence() {}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasContainerItem(ItemStack itemStack)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: really? this looks well dodgy.
|
|
||||||
@Override
|
|
||||||
public ItemStack getContainerItem(ItemStack itemStack)
|
|
||||||
{
|
|
||||||
return itemStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BiomeGenBase getBiome(ItemStack itemStack)
|
public BiomeGenBase getBiome(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("biomeID"))
|
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("biomeID"))
|
||||||
|
|
Loading…
Reference in New Issue