/**
* Called upon block activation (right click on the block.)
*/
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{
if (p_149727_1_.isRemote)
{
return true;
}
else
{
ItemStack itemstack = p_149727_5_.inventory.getCurrentItem();
if (itemstack == null)
{
return true;
}
else
{
int i1 = p_149727_1_.getBlockMetadata(p_149727_2_, p_149727_3_, p_149727_4_);
int j1 = func_150027_b(i1);
if (itemstack.getItem() == Items.water_bucket)
{
if (j1 < 3)
{
if (!p_149727_5_.capabilities.isCreativeMode)
{
p_149727_5_.inventory.setInventorySlotContents(p_149727_5_.inventory.currentItem, new ItemStack(Items.bucket));
}
this.func_150024_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, 3);
}
return true;
}
else
{
if (itemstack.getItem() == Items.glass_bottle)
{
if (j1 > 0)
{
if (!p_149727_5_.capabilities.isCreativeMode)
{
ItemStack itemstack1 = new ItemStack(Items.potionitem, 1, 0);
if (!p_149727_5_.inventory.addItemStackToInventory(itemstack1))
{
p_149727_1_.spawnEntityInWorld(new EntityItem(p_149727_1_, (double)p_149727_2_ + 0.5D, (double)p_149727_3_ + 1.5D, (double)p_149727_4_ + 0.5D, itemstack1));
}
else if (p_149727_5_ instanceof EntityPlayerMP)
{
((EntityPlayerMP)p_149727_5_).sendContainerToPlayer(p_149727_5_.inventoryContainer);
}
--itemstack.stackSize;
if (itemstack.stackSize <= 0)
{
p_149727_5_.inventory.setInventorySlotContents(p_149727_5_.inventory.currentItem, (ItemStack)null);
}
}
this.func_150024_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, j1 - 1);
}
}
else if (j1 > 0 && itemstack.getItem() instanceof ItemArmor && ((ItemArmor)itemstack.getItem()).getArmorMaterial() == ItemArmor.ArmorMaterial.CLOTH)
{
ItemArmor itemarmor = (ItemArmor)itemstack.getItem();
itemarmor.removeColor(itemstack);
this.func_150024_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, j1 - 1);
return true;
}
return false;
}
}
}
}