Baubles now able to IBlockProvide

This allows for things like Botanical Addons’ Toolbelt to provide from
the tools in them while worn.
This commit is contained in:
yrsegal committed 2016-01-12 07:47:30 -05:00
1 parent b7975401b3
commit c20247b680
1 file changed
+13 -2
@@ -31,6 +31,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.IBlockProvider;
import vazkii.botania.api.item.IManaProficiencyArmor;
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
@@ -278,13 +279,23 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra
if(player.capabilities.isCreativeMode)
return new ItemStack(block, 1, meta);
return removeFromInventory(player, player.inventory, stack, block, meta, doit);
ItemStack outStack = removeFromInventory(player, BotaniaAPI.internalHandler.getBaublesInventory(player), stack, block, meta, doit);
if (outStack == null)
outStack = removeFromInventory(player, player.inventory, stack, block, meta, doit);
return outStack;
}
public static int getInventoryItemCount(EntityPlayer player, ItemStack stack, Block block, int meta) {
if(player.capabilities.isCreativeMode)
return -1;
return getInventoryItemCount(player, player.inventory, stack, block, meta);
int baubleCount = getInventoryItemCount(player, BotaniaAPI.internalHandler.getBaublesInventory(player), stack, block, meta);
if (baubleCount == -1) return -1;
int count = getInventoryItemCount(player, player.inventory, stack, block, meta);
if (count == -1) return -1;
return count+baubleCount;
}
public static int getInventoryItemCount(EntityPlayer player, IInventory inv, ItemStack stack, Block block, int meta) {