Apply to shovel and axe as well

This commit is contained in:
ljfa-ag 2015-04-10 20:30:52 +02:00
parent d800e06cb8
commit 1887df3d1e
3 changed files with 30 additions and 32 deletions

View file

@ -2,8 +2,10 @@ package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
import WayofTime.alchemicalWizardry.common.ItemType;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multimap;
import cpw.mods.fml.relauncher.Side;
@ -141,6 +143,8 @@ public class BoundShovel extends ItemSpade implements IBindable
boolean silkTouch = EnchantmentHelper.getSilkTouchModifier(par3EntityPlayer);
int fortuneLvl = EnchantmentHelper.getFortuneModifier(par3EntityPlayer);
HashMultiset<ItemType> dropMultiset = HashMultiset.create();
for (int i = -5; i <= 5; i++)
{
for (int j = 0; j <= 10; j++)
@ -158,25 +162,15 @@ public class BoundShovel extends ItemSpade implements IBindable
{
if (silkTouch && block.canSilkHarvest(par2World, par3EntityPlayer, posX + i, posY + j, posZ + k, meta))
{
ItemStack droppedItem = new ItemStack(block, 1, meta);
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, droppedItem));
}
dropMultiset.add(new ItemType(block, meta));
} else
{
ArrayList<ItemStack> itemDropList = block.getDrops(par2World, posX + i, posY + j, posZ + k, meta, fortuneLvl);
if (itemDropList != null)
{
for (ItemStack item : itemDropList)
{
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityItem(par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ, item));
}
}
for (ItemStack stack : itemDropList)
dropMultiset.add(ItemType.fromStack(stack), stack.stackSize);
}
}
@ -186,6 +180,8 @@ public class BoundShovel extends ItemSpade implements IBindable
}
}
}
BoundPickaxe.dropMultisetStacks(dropMultiset, par2World, posX, posY + par3EntityPlayer.getEyeHeight(), posZ);
return par1ItemStack;
}